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. --- playbooks/deploy.yml | 15 --------------- playbooks/new.theopensourceway.org.yml | 15 +++++++++++++++ roles/local_deploy/files/ansible_run.sh | 12 +++++++++++- 3 files changed, 26 insertions(+), 16 deletions(-) delete mode 100644 playbooks/deploy.yml create mode 100644 playbooks/new.theopensourceway.org.yml diff --git a/playbooks/deploy.yml b/playbooks/deploy.yml deleted file mode 100644 index 4ecb493..0000000 --- a/playbooks/deploy.yml +++ /dev/null @@ -1,15 +0,0 @@ ---- -- hosts: new - vars: - mailman_webinterface: lists.theopensourceway.org - mailman_prefix: theopensourceway.org - mailman_lists: - - { name: infrastructure, owner: mscherer@redhat.com} - - { name: metrics-wg, owner: mscherer@redhat.com} - - { name: oss-consulting-wg, owner: mscherer@redhat.com} - roles: - - base - - admin_ssh_keys - - local_deploy - - mailman_lists - - cgit diff --git a/playbooks/new.theopensourceway.org.yml b/playbooks/new.theopensourceway.org.yml new file mode 100644 index 0000000..6051910 --- /dev/null +++ b/playbooks/new.theopensourceway.org.yml @@ -0,0 +1,15 @@ +--- +- hosts: new.theopensourceway.org + vars: + mailman_webinterface: lists.theopensourceway.org + mailman_prefix: theopensourceway.org + mailman_lists: + - { name: infrastructure, owner: mscherer@redhat.com} + - { name: metrics-wg, owner: mscherer@redhat.com} + - { name: oss-consulting-wg, owner: mscherer@redhat.com} + roles: + - base + - admin_ssh_keys + - local_deploy + - mailman_lists + - cgit 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