Last active
December 18, 2015 09:19
-
-
Save cbednarski/5760927 to your computer and use it in GitHub Desktop.
Knife bootstrap shell wrapper
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
#!/bin/bash | |
set -x | |
if [ $# == 2 ]; then | |
echo ">>> Cleaning up existing chef environment" | |
knife node delete -y $2 | |
knife client delete -y $2 | |
ssh -l root $2 'yum remove -y chef' | |
ssh -l root $2 'rm -rf /etc/chef' | |
ssh -l root $2 'rm -rf /opt/chef' | |
echo ">>> Bootstrapping $1 $2" | |
knife bootstrap -E $1 -x root $2 -N $2 | |
knife node run_list add $2 "recipe[mysql],recipe[memcache]" | |
scp ~/.chef/encrypted_data_bag_secret root@$2:/etc/chef/ | |
echo ">>> Running Chef Client" | |
ssh -l root $2 'chef-client' | |
exit 0 | |
else | |
echo "wrong number of parameters" | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment