ansible/roles/common/files/ansible-run

28 lines
533 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"
ansible_is_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
}
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-05 17:36:23 +00:00
while [ -f $SCHED ]
do
rm $SCHED
ansible_is_running
touch $HOOK
done
2020-12-07 15:32:19 +00:00
rm $RUNNING
fi