summaryrefslogtreecommitdiffstats
path: root/roles
diff options
context:
space:
mode:
authorMichael Scherer <misc@zarb.org>2014-12-13 00:32:15 +0100
committerMichael Scherer <misc@zarb.org>2014-12-13 00:32:15 +0100
commitc5fb1a829d6cb80d2af4620308f91e68ce282476 (patch)
treebe2ace55f935453e23022883c9162000d4b229f4 /roles
parent8ca9b85c45afa18113180b72fcf92b5d90c995e9 (diff)
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.
Diffstat (limited to 'roles')
-rw-r--r--roles/local_deploy/files/ansible_run.sh12
1 files changed, 11 insertions, 1 deletions
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