From 88bb586da534bda6975a2bdbcb2c36e1053451c9 Mon Sep 17 00:00:00 2001 From: Naglfar Date: Sat, 5 Dec 2020 18:36:23 +0100 Subject: [PATCH] Ansible setscheduler added. --- roles/common/files/ansible-run | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/roles/common/files/ansible-run b/roles/common/files/ansible-run index fd215ea9..34dc6153 100644 --- a/roles/common/files/ansible-run +++ b/roles/common/files/ansible-run @@ -1,6 +1,7 @@ #!/bin/bash export RUNNING="/dev/shm/ansible_is_running" export HOOK="/dev/shm/ansible-hook-last-run" +export SCHED="/dev/shm/ansible_scheduler" ansible_is_running() { @@ -9,11 +10,18 @@ ansible_is_running() /usr/local/bin/ansible-playbook -i /var/thunix/ansible/hosts /var/thunix/ansible/site.yml -u root } +# sets ansible scheduling +touch $SCHED + if [ -f $RUNNING ]; then echo "Ansible is currently running." else - touch $RUNNING - ansible_is_running - touch $HOOK - rm $RUNNING + while [ -f $SCHED ] + do + rm $SCHED + touch $RUNNING + ansible_is_running + touch $HOOK + rm $RUNNING + done fi