Guest User

Untitled

a guest
Jan 24th, 2018
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.16 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # NOTE: The following script assumes that you have 1 node with hostname
  4. # tandem-ac. Please modify it for the appropriate hostname, and bootstrap
  5. # the node ahead of time. Also, set password below. Finally, make sure
  6. # you have a hosts entry configured for it if it's not normally
  7. # available by hostname.
  8.  
  9. # NOTE: It also must be run from a set-up chef repo.
  10.  
  11. echo "# First, handle tandem app"
  12. echo "# ========================"
  13. echo "# Upload the role"
  14. knife role from file tandem.rb
  15. echo "# Upload the databag"
  16. knife data bag from file apps tandem.json
  17. echo "# Upload the cookbook"
  18. knife cookbook upload tandem
  19. echo "# Add the roles to the node"
  20. knife node run_list add tandem-ac "role[production]"
  21. knife node run_list add tandem-ac "role[tandem_database_master]"
  22. knife node run_list add tandem-ac "role[tandem]"
  23. echo "# sleep 120 so that the node can be found with knife search"
  24. sleep 120
  25. echo "# run the deploy"
  26. knife ssh role:tandem chef-client -x root -P tandem-aciu1SuW6V6
  27. echo "# teardown"
  28. echo "# remove the roles from the node"
  29. knife node run_list remove tandem-ac "role[production]"
  30. knife node run_list remove tandem-ac "role[tandem_database_master]"
  31. knife node run_list remove tandem-ac "role[tandem]"
  32.  
  33. echo "# Then, handle tandem_ac app"
  34. echo "# =========================="
  35. echo "# Upload the role"
  36. knife role from file tandem_ac.rb
  37. echo "# Upload the databag"
  38. knife data bag from file apps tandem_ac.json
  39. echo "# Upload the cookbook"
  40. knife cookbook upload tandem_ac
  41. echo "# Add the roles to the node"
  42. knife node run_list add tandem-ac "role[production]"
  43. knife node run_list add tandem-ac "role[tandem_ac_database_master]"
  44. knife node run_list add tandem-ac "role[tandem_ac]"
  45. knife node run_list add tandem-ac "recipe[tandem]"
  46. echo "# sleep 120 so that the node can be found with knife search"
  47. sleep 120
  48. echo "# run the deploy"
  49. knife ssh role:tandem_ac chef-client -x root -P tandem-aciu1SuW6V6
  50. echo "# teardown"
  51. echo "# remove the roles from the node"
  52. knife node run_list remove tandem-ac "role[production]"
  53. knife node run_list remove tandem-ac "role[tandem_ac_database_master]"
  54. knife node run_list remove tandem-ac "role[tandem_ac]"
  55. knife node run_list remove tandem-ac "recipe[tandem]"
Add Comment
Please, Sign In to add comment