Skip to content

Instantly share code, notes, and snippets.

@dmerrick
Created March 30, 2012 15:26
Show Gist options
  • Select an option

  • Save dmerrick/2252275 to your computer and use it in GitHub Desktop.

Select an option

Save dmerrick/2252275 to your computer and use it in GitHub Desktop.
bash -c '
# removed installation, presumably Chef is installed on existing nodes
# adapted by Dana from the migration linked to from this document:
# http://wiki.opscode.com/display/chef/Migrating+to+Hosted+Chef+from+an+Open+Source+Chef+Server+implementation
mv /etc/chef/client.pem{,.old_chef_server}
mv /etc/chef/validation.pem{,.old_chef_server}
(
cat <<'EOP'
<%= validation_key %>
EOP
) > /tmp/validation.pem
awk NF /tmp/validation.pem > /etc/chef/validation.pem
rm /tmp/validation.pem
(
cat <<'EOP'
<%= config_content %>
EOP
) > /etc/chef/client.rb
<% if @chef_config[:encrypted_data_bag_secret] -%>
(
cat <<'EOP'
<%= encrypted_data_bag_secret %>
EOP
) > /tmp/encrypted_data_bag_secret
awk NF /tmp/encrypted_data_bag_secret > /etc/chef/encrypted_data_bag_secret
rm /tmp/encrypted_data_bag_secret
<% end -%>
chef-client
'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment