mirror of
https://github.com/ThunixdotNet/ansible.git
synced 2026-01-24 13:40:17 +00:00
Added some sanity checking, to preclude concurrent runs
This commit is contained in:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user