Matrix Docker Ansible eploy
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 

38 righe
963 B

  1. #!/usr/bin/env bash
  2. #
  3. # Wrapper script for the entire update procedure including
  4. # * updating git repo
  5. # * downloading roles
  6. # * running playbook
  7. #
  8. # This script first asks for the passwords for all the hosts and then pipes them
  9. # to the ansible playbook wrapper script, so that we don't need to wait for the
  10. # merging and downloading to finish, before being asked for the passwords.
  11. #
  12. # exit on errors
  13. set -e
  14. # set playbook root path
  15. root=$(dirname "$(readlink -f "$0")")/../..
  16. # capture passwords for all hosts
  17. for host in "$root"/inventory/*.yml; do
  18. read -rp "sudo password for $(basename "$host"): " -s pw
  19. pipeinput+="$pw\n"
  20. echo
  21. done
  22. # merge upstream master branch
  23. git -C "$root" pull upstream master
  24. # check the changelog before updating
  25. less CHANGELOG.md
  26. read -r
  27. # download upstream roles
  28. make -f "$root"/Makefile roles
  29. # run ansible-playbook on all hosts
  30. echo -e "$pipeinput" | bash "$root"/inventory/scripts/ansible-all-hosts.sh