-
Notifications
You must be signed in to change notification settings - Fork 6
/
run-ansible.sh
executable file
·36 lines (26 loc) · 940 Bytes
/
run-ansible.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/bash
#### Written by: John McDonough - @movinalot
#### Description: Runs Ansible update based on updated site.yml
#### This script is triggered by github push, pull the repo
cd ~/projects/ansible-configurations
git pull
#### Cycle through cmdline parameters, each one represents an Ansible
#### configuration directory. A parameter representing a configuration
#### will only be passed to this script if an update was detected to
#### files in it's directory.
#### Dependencies
#### The password for ansible-vault is stored in a file called
#### .vault_pass.txt in the directory of the user that runs this script
####
for DOMAIN in "$@"
do
if [[ -e ${DOMAIN}/site.yml ]]; then
echo "Processing site.yml for domain: " ${DOMAIN}
cd ${DOMAIN}
ansible-playbook -i inventory site.yml --vault-password-file=~/.vault_pass.txt
if [[ -e site.retry ]]; then
rm site.retry
fi
cd ..
fi
done