Finish off that playbook.

This commit is contained in:
Ralph Bean 2013-08-21 20:05:42 +00:00
parent 99266722b6
commit a5aca28f0f

View file

@ -1,12 +1,49 @@
# requires --extra-vars="repos='yokan.git;yumex.git;yum-langpacks.git'"
# requires --extra-vars "{'repos': ['yokan.git', 'yumex.git']}"
- name: Install the fedmsg hook into a number of fedrahosted git repos
hosts: hosted03.fedoraproject.org
user: root
vars:
prefix: /srv/git/
chained: /hooks/post-receive-chained.d
fedmsg_hook: /usr/local/share/git/hooks/post-receive-fedorahosted-fedmsg
chained_hook: /usr/share/git-core/post-receive-chained
tasks:
# First -- a sanity check. We want this to fail and stop the playbook if
# someone typoed and reponame. The "command" here claims that it "creates" a
# file. That is not actually true, but it tells ansible to not bother running
# the command *if* that creates= file is already present. Its a hackaround to
# make this task idempotent.
- name: make sure the git repos exist in the first place
command: /bin/ls ${prefix}${item} creates=${prefix}${item}
with_items: ${repos}
- name: ensure there is a post-receive-chained.d/ directory
file: >
state=directory
path=/srv/git/${item}/hooks/post-receive-chained.d/
path=${prefix}${item}${chained}/
with_items: ${repos}
- name: move the old post-receive email hook into the chained dir
command: >
/bin/mv ${prefix}${item}/hooks/post-receive ${prefix}${item}${chained}/post-receive-email
removes=${prefix}${item}/hooks/post-receive
creates=${prefix}${item}${chained}/post-receive-email
with_items: ${repos}
- name: symlink the fedmsg hook into the chained dir
file: >
path=${prefix}${item}${chained}/post-receive-fedmsg
src=${fedmsg_hook}
state=link
with_items: ${repos}
- name: symlink in the chained hook redirector
file: >
path=${prefix}${item}/hooks/post-receive
src=${chained_hook}
state=link
with_items: ${repos}