infra/roles/mainframe/templates/ansible-convergence.sh.j2

29 lines
659 B
Django/Jinja

#!/bin/bash
set -e
LOCKFILE=/tmp/ansible-convergence.lock
/usr/bin/lockfile -r 0 $LOCKFILE
{% set base = git_cron.base_path %}
{% set tools_path = "/var/www/" + git_cron.tools_url %}
cd {{ base }}/infra
if [ "$1" = "sensors" ]; then
ansible-playbook \
-i hosts-sensors.yml \
sensors.yml \
--diff \
--check &> {{ base }}/ansible-convergence-sensors.txt
else
ansible-playbook \
-i hosts.yml \
{{ git_cron.convergence }} \
--diff \
--check &> {{ base }}/ansible-convergence.txt
fi
/usr/bin/cp {{ base }}/ansible-convergence*.txt {{ tools_path }}/convergence/
/usr/bin/rm -f $LOCKFILE