Created
March 18, 2015 20:20
-
-
Save tfitch/f9ca2d2194d1cd4f968a to your computer and use it in GitHub Desktop.
Chef data bags with environments
This file contains hidden or 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
# the key here is line 4 where the node.chef_environment will match an element of the JSON | |
keyfile_bag = Chef::EncryptedDataBagItem.load("mongodb", "keyfiles") | |
file '/apps/mongodb-linux-x86_64-2.4.8/conf/mongodb.key' do | |
content keyfile_bag[node.chef_environment]['keyfile'] | |
owner 'mongo' | |
group 'mongo' | |
mode 00700 | |
action :create_if_missing | |
end |
This file contains hidden or 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
{ | |
"id": "keyfiles", | |
"production" : { | |
"keyfile" : "GaZvLzM0AB1gQ" | |
}, | |
"stage" : { | |
"keyfile" : "mXlB1LmSqj3nq" | |
}, | |
"load": { | |
"keyfile" : "Aoua2K2OfdTSi" | |
}, | |
"localhost" : { | |
"keyfile" : "tkhTjuydq8PJS" | |
}, | |
"_default" : { | |
"keyfile" : "h34kwGTNoPFoU" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment