Added some sanity checking, to preclude concurrent runs
This commit is contained in:
parent
2ce55a935b
commit
91c0204682
|
@ -1,7 +1,16 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
export RUNNING="/dev/shm/ansible_is_running"
|
||||||
|
|
||||||
cd /var/thunix/ansible
|
if [ -f $RUNNING ]; then
|
||||||
/usr/bin/git pull
|
echo "Ansible is currently running."
|
||||||
/usr/local/bin/ansible-playbook -i /var/thunix/ansible/hosts /var/thunix/ansible/site.yml -u root
|
exit 1
|
||||||
rm /dev/shm/run-ansible
|
else
|
||||||
touch /dev/shm/ansible-hook-last-run
|
touch $RUNNING
|
||||||
|
cd /var/thunix/ansible
|
||||||
|
/usr/bin/git pull
|
||||||
|
/usr/local/bin/ansible-playbook -i /var/thunix/ansible/hosts /var/thunix/ansible/site.yml -u root
|
||||||
|
rm /dev/shm/run-ansible
|
||||||
|
touch /dev/shm/ansible-hook-last-run
|
||||||
|
rm $RUNNING
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
Loading…
Reference in New Issue