Skip to content

Instantly share code, notes, and snippets.

@luisbosque
Created August 27, 2010 12:16
Show Gist options
  • Save luisbosque/553250 to your computer and use it in GitHub Desktop.
Save luisbosque/553250 to your computer and use it in GitHub Desktop.
#!/bin/bash
CHEF_CONF="/etc/default/chef-client"
if [[ -f $CHEF_CONF ]]
then
. $CHEF_CONF
fi
if [[ $BOOTSTRAP != 1 ]]
then
exit 0
fi
rm /etc/chef/client.pem
chef-solo -c $CHEF_SOLO -j $CHEF_JSON -r $BOOTSTRAP_URL
chef-client
if [[ $? == 0 ]]
then
sed -r -i "s/BOOTSTRAP=.*/BOOTSTRAP=0/" $CHEF_CONF
rm $VALIDATION_PEM
fi
/etc/init.d/chef-client restart
BOOTSTRAP=0
BOOTSTRAP_URL="http://s3.amazonaws.com/chef-solo/bootstrap-latest.tar.gz"
CHEF_SOLO="/etc/chef/solo.rb"
CHEF_JSON="/root/chef.json"
VALIDATION_PEM="/etc/chef/validation.pem"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment