ansible/roles/common/files/ansible-run

23 lines
488 B
Plaintext
Raw Normal View History

#!/bin/bash
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"
2020-12-05 17:36:23 +00:00
# sets ansible scheduling
touch $SCHED
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
fi