Document how to expand loopabull's usage

Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
This commit is contained in:
Pierre-Yves Chibon 2018-08-10 16:06:15 +02:00
parent 21a582d885
commit 1e964c076a

View file

@ -11,6 +11,46 @@ This repository stores the ansible playbooks and their related scripts used by
the `Fedora`_ `Infrastructure`_ team.
Adding a new task
-----------------
Adding a new task to loopabull is quite easy.
* Figure out which fedmsg topic you want to trigger off
* Create a playbook named after the topic
* Create a role doing the action you want to have triggered of this topic
* Configure loopabull to listen to this topic
* Push the new loopabull configuration
For example, let's run a small/dummy python script everytime a koji build
finished in staging.
The topic we want to trigger of is thus: ``org.fedoraproject.stg.buildsys.build.state.change``,
so we go and edit the playbook: ``playbooks/org.fedoraproject.stg.buildsys.build.state.change.yml``
in this repository and add a `debug` role that has one variable: the message
received via fedmsg `msg`.
Then add a ``debug`` role in ``playbooks/roles/debug``. Make that role install
your python script, call it with a certain environment variable and print
the output of the script for debugging.
Then, on the infrastructure's ansible repository, configure loopabull to listen
to this topic (line 70):
https://infrastructure.fedoraproject.org/cgit/ansible.git/tree/playbooks/groups/loopabull.yml?id=4b053dd68cc12e1823516eec481fab04f9b9166b#n70
Finally, run the ansible playbook deploying this change:
::
ansible-playbook /srv/web/infra/ansible/playbooks/groups/loopabull.yml -t loopabull
.. note:: you may have to restart things on loopabull's side:
::
systemctl restart loopabull loopabull@1 loopabull@2 loopabull@3 loopabull@4 loopabull@5
Good Practice
-------------