Created
March 19, 2015 22:50
-
-
Save kgorskowski/185f63c22c45efe5159b to your computer and use it in GitHub Desktop.
create encrypted data bags for chef manually
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'chef/encrypted_data_bag_item' | |
secret = Chef::EncryptedDataBagItem.load_secret('chef_secret') | |
data = {"id" => "name_of_secret_goes_here", "key" => 'secret_goes_here'} | |
encrypted_data = Chef::EncryptedDataBagItem.encrypt_data_bag_item(data, secret) | |
FileUtils.mkpath('data_bags/passwords') | |
File.open('data_bags/passwords/name_of_secret_goes_here.json', 'w') do |f| | |
f.print encrypted_data.to_json | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment