From c5fb1a829d6cb80d2af4620308f91e68ce282476 Mon Sep 17 00:00:00 2001 From: Michael Scherer Date: Sat, 13 Dec 2014 00:32:15 +0100 Subject: Use a different script where each playbook is on a per host basis This would scale better the day we have more than 1 host, even if the whole idea of having multiple repository would still be a issue. I however plan to use requirements.txt and ansible-galaxy to alleviate the duplication problems. --- roles/local_deploy/files/ansible_run.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'roles/local_deploy') diff --git a/roles/local_deploy/files/ansible_run.sh b/roles/local_deploy/files/ansible_run.sh index db4888f..4430224 100644 --- a/roles/local_deploy/files/ansible_run.sh +++ b/roles/local_deploy/files/ansible_run.sh @@ -1,3 +1,13 @@ #!/bin/sh cd /etc/ansible -ansible-playbook -l "$(hostname -f)," -c local playbooks/deploy.yml +for i in local $(hostname -s) $(hostname -f); do + FILE=playbooks/${i}.yml + [ -f $FILE ] && RESULT=$FILE +done + +if [ -n $RESULT ]; then + ansible-playbook -c local $RESULT +else + echo "No playbook for this host found" + exit 1 +fi -- cgit