2019-03-18 12:53:49 +00:00
|
|
|
#!/bin/bash
|
2019-03-18 13:08:55 +00:00
|
|
|
export RUNNING="/dev/shm/ansible_is_running"
|
2020-12-05 17:09:03 +00:00
|
|
|
export HOOK="/dev/shm/ansible-hook-last-run"
|
2020-12-05 17:36:23 +00:00
|
|
|
export SCHED="/dev/shm/ansible_scheduler"
|
2019-03-18 12:53:49 +00:00
|
|
|
|
2020-12-05 17:36:23 +00:00
|
|
|
# sets ansible scheduling
|
|
|
|
touch $SCHED
|
|
|
|
|
2019-03-18 13:08:55 +00:00
|
|
|
if [ -f $RUNNING ]; then
|
|
|
|
echo "Ansible is currently running."
|
|
|
|
else
|
2020-12-07 15:32:19 +00:00
|
|
|
touch $RUNNING
|
2020-12-10 15:45:00 +00:00
|
|
|
cd /var/thunix/ansible
|
2020-12-05 17:36:23 +00:00
|
|
|
while [ -f $SCHED ]
|
|
|
|
do
|
|
|
|
rm $SCHED
|
2020-12-10 15:45:00 +00:00
|
|
|
/usr/bin/git pull
|
|
|
|
/usr/local/bin/ansible-playbook -i /var/thunix/ansible/hosts /var/thunix/ansible/site.yml -u root
|
2020-12-05 17:36:23 +00:00
|
|
|
touch $HOOK
|
|
|
|
done
|
2020-12-07 15:32:19 +00:00
|
|
|
rm $RUNNING
|
2019-03-18 13:08:55 +00:00
|
|
|
fi
|