diff options
author | Michael Scherer <misc@zarb.org> | 2014-12-13 00:32:15 +0100 |
---|---|---|
committer | Michael Scherer <misc@zarb.org> | 2014-12-13 00:32:15 +0100 |
commit | c5fb1a829d6cb80d2af4620308f91e68ce282476 (patch) | |
tree | be2ace55f935453e23022883c9162000d4b229f4 | |
parent | 8ca9b85c45afa18113180b72fcf92b5d90c995e9 (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.
-rw-r--r-- | playbooks/new.theopensourceway.org.yml (renamed from playbooks/deploy.yml) | 2 | ||||
-rw-r--r-- | roles/local_deploy/files/ansible_run.sh | 12 |
2 files changed, 12 insertions, 2 deletions
diff --git a/playbooks/deploy.yml b/playbooks/new.theopensourceway.org.yml index 4ecb493..6051910 100644 --- a/playbooks/deploy.yml +++ b/playbooks/new.theopensourceway.org.yml @@ -1,5 +1,5 @@ --- -- hosts: new +- hosts: new.theopensourceway.org vars: mailman_webinterface: lists.theopensourceway.org mailman_prefix: theopensourceway.org 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 |