Created
August 18, 2011 16:28
-
-
Save knewter/1154461 to your computer and use it in GitHub Desktop.
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 | |
# NOTE: The following script assumes that you have 1 node with hostname | |
# tandem-ac. Please modify it for the appropriate hostname, and bootstrap | |
# the node ahead of time. Also, set password below. Finally, make sure | |
# you have a hosts entry configured for it if it's not normally | |
# available by hostname. | |
# NOTE: It also must be run from a set-up chef repo. | |
echo "# First, handle tandem app" | |
echo "# ========================" | |
echo "# Upload the role" | |
knife role from file tandem.rb | |
echo "# Upload the databag" | |
knife data bag from file apps tandem.json | |
echo "# Upload the cookbook" | |
knife cookbook upload tandem | |
echo "# Add the roles to the node" | |
knife node run_list add tandem-ac "role[production]" | |
knife node run_list add tandem-ac "role[tandem_database_master]" | |
knife node run_list add tandem-ac "role[tandem]" | |
echo "# sleep 120 so that the node can be found with knife search" | |
sleep 120 | |
echo "# run the deploy" | |
knife ssh role:tandem chef-client -x root -P tandem-aciu1SuW6V6 | |
echo "# teardown" | |
echo "# remove the roles from the node" | |
knife node run_list remove tandem-ac "role[production]" | |
knife node run_list remove tandem-ac "role[tandem_database_master]" | |
knife node run_list remove tandem-ac "role[tandem]" | |
echo "# Then, handle tandem_ac app" | |
echo "# ==========================" | |
echo "# Upload the role" | |
knife role from file tandem_ac.rb | |
echo "# Upload the databag" | |
knife data bag from file apps tandem_ac.json | |
echo "# Upload the cookbook" | |
knife cookbook upload tandem_ac | |
echo "# Add the roles to the node" | |
knife node run_list add tandem-ac "role[production]" | |
knife node run_list add tandem-ac "role[tandem_ac_database_master]" | |
knife node run_list add tandem-ac "role[tandem_ac]" | |
knife node run_list add tandem-ac "recipe[tandem]" | |
echo "# sleep 120 so that the node can be found with knife search" | |
sleep 120 | |
echo "# run the deploy" | |
knife ssh role:tandem_ac chef-client -x root -P tandem-aciu1SuW6V6 | |
echo "# teardown" | |
echo "# remove the roles from the node" | |
knife node run_list remove tandem-ac "role[production]" | |
knife node run_list remove tandem-ac "role[tandem_ac_database_master]" | |
knife node run_list remove tandem-ac "role[tandem_ac]" | |
knife node run_list remove tandem-ac "recipe[tandem]" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment