mirror of
https://github.com/ThunixdotNet/ansible.git
synced 2026-01-25 05:40:17 +00:00
Improve the ansible scheduler
This commit is contained in:
@@ -1,22 +1,22 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
export RUNNING="/dev/shm/ansible_is_running"
|
export RUNNING="/dev/shm/ansible_is_running"
|
||||||
export HOOK="/dev/shm/ansible-hook-last-run"
|
export HOOK="/dev/shm/ansible-hook-last-run"
|
||||||
export SCHED="/dev/shm/ansible_scheduler"
|
export PATHMODIFIED="/dev/shm/run-ansible"
|
||||||
|
export SCHED=1
|
||||||
# sets ansible scheduling
|
|
||||||
touch $SCHED
|
|
||||||
|
|
||||||
if [ -f $RUNNING ]; then
|
if [ -f $RUNNING ]; then
|
||||||
echo "Ansible is currently running."
|
echo "Ansible is currently running."
|
||||||
else
|
else
|
||||||
cd /var/thunix/ansible
|
cd /var/thunix/ansible
|
||||||
while [ -f $SCHED ]
|
while [ $SCHED = 1 ]
|
||||||
do
|
do
|
||||||
rm $SCHED
|
|
||||||
touch $RUNNING
|
touch $RUNNING
|
||||||
/usr/bin/git pull
|
/usr/bin/git pull
|
||||||
/usr/local/bin/ansible-playbook -i /var/thunix/ansible/hosts /var/thunix/ansible/site.yml -u root
|
/usr/local/bin/ansible-playbook -i /var/thunix/ansible/hosts /var/thunix/ansible/site.yml -u root
|
||||||
touch $HOOK
|
touch $HOOK
|
||||||
|
|
||||||
|
[ "$PATHMODIFIED" -ot "$RUNNING" ] && SCHED=0
|
||||||
|
! [ -f "$PATHMODIFIED" ] && SCHED=0
|
||||||
done
|
done
|
||||||
rm $RUNNING
|
rm $RUNNING
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user