Skip to content

Instantly share code, notes, and snippets.

@Atalanta
Created March 2, 2011 10:05
Show Gist options
  • Select an option

  • Save Atalanta/850725 to your computer and use it in GitHub Desktop.

Select an option

Save Atalanta/850725 to your computer and use it in GitHub Desktop.
sh -c '
mkdir -p /etc/chef
(
cat <<'EOP'
<%= IO.read(Chef::Config[:validation_key]) %>
EOP
) > /tmp/validation.pem
awk NF /tmp/validation.pem > /etc/chef/validation.pem
rm /tmp/validation.pem
(
cat <<'EOP'
log_level :info
log_location STDOUT
chef_server_url "<%= Chef::Config[:chef_server_url] %>"
validation_client_name "<%= Chef::Config[:validation_client_name] %>"
<% if @config[:chef_node_name] == nil %>
# Using default node name"
<% else %>
node_name "<%= @config[:chef_node_name] %>"
<% end %>
EOP
) > /etc/chef/client.rb
(
cat <<'EOP'
<%= { "run_list" => @run_list }.to_json %>
EOP
) > /etc/chef/first-boot.json
/usr/local/bin/chef-client -k /etc/chef/client.pem -K /etc/chef/validation.pem -c /etc/chef/client.rb'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment