From 51786d8c72844bf1734f815d5ce8fb570b19323b Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Fri, 18 Oct 2019 15:23:25 +0200 Subject: [PATCH] resultsdb: install and configure the new ci-resultsdb-listener in staging - step #1 Signed-off-by: Pierre-Yves Chibon --- playbooks/groups/resultsdb.yml | 26 ++++++++++++++++-- roles/ci_resultsdb/tasks/main.yml | 45 +++++++++++++++++++++++++------ 2 files changed, 61 insertions(+), 10 deletions(-) diff --git a/playbooks/groups/resultsdb.yml b/playbooks/groups/resultsdb.yml index 92ad3dade9..7ce0250a78 100644 --- a/playbooks/groups/resultsdb.yml +++ b/playbooks/groups/resultsdb.yml @@ -30,11 +30,33 @@ when: deployment_type == "prod" } - apache - { role: fedmsg/base, - when: deployment_type != "dev" } + when: deployment_type == "prod" } - { role: dnf-automatic, tags: ['dnfautomatic'] } # Set up for fedora-messaging - { role: rabbit/user, username: "resultsdb{{ env_suffix }}"} + - role: rabbit/queue + username: "resultsdb{{ env_suffix }}" + queue_name: "resultsdb{{ env_suffix }}_ci_listener" + routing_keys: + - "org.centos.prod.ci.pipeline.allpackages-build.complete" + - "org.centos.prod.ci.pipeline.allpackages-build.image.complete" + - "org.centos.prod.ci.pipeline.allpackages-build.package.test.functional.complete" + - "org.centos.prod.ci.pipeline.allpackages-build.package.complete" + - "org.centos.prod.ci.pipeline.allpackages-build.package.ignored" + - "org.centos.prod.ci.koji-build.test.queued" + - "org.centos.prod.ci.koji-build.test.running" + - "org.centos.prod.ci.koji-build.test.complete" + - "org.centos.prod.ci.koji-build.test.error" + write_queues: + - "ci" + - "openqa" + vars: + # yes, even the staging scheduler listens to production, it + # has to or else it wouldn't schedule any jobs + env: "production" + env_suffix: "" + tags: ['rabbit'] tasks: # this is how you include other task lists @@ -78,5 +100,5 @@ - /srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml roles: - - { role: rdbsync, tags: ['rdbsync']} + - { role: rdbsync, tags: ['rdbsync'], when: deployment_type == "prod" } - { role: ci_resultsdb, tags: ['ci_resultsdb'], when: deployment_type == "stg" } diff --git a/roles/ci_resultsdb/tasks/main.yml b/roles/ci_resultsdb/tasks/main.yml index 4ea17bdd10..da88e25ab1 100644 --- a/roles/ci_resultsdb/tasks/main.yml +++ b/roles/ci_resultsdb/tasks/main.yml @@ -5,12 +5,16 @@ - python-ci-resultsdb-listener - libsemanage-python - rdbsync + when: + - inventory_hostname != "resultsdb-stg01.qa.fedoraproject.org" } - name: Create /etc/pki/fedmsg/ file: name=/etc/pki/fedmsg state=directory recurse=yes owner=root group=root + when: + - inventory_hostname != "resultsdb-stg01.qa.fedoraproject.org" } tags: - config @@ -21,6 +25,8 @@ owner=root group=root mode=0644 + when: + - inventory_hostname != "resultsdb-stg01.qa.fedoraproject.org" } tags: - config @@ -38,19 +44,19 @@ owner=root group=root mode=0644 with_items: - { file: listener.cfg, location: /etc/ci-resultsdb-listener/ } - - { file: endpoints.py, location: /etc/fedmsg.d/, - when: inventory_hostname != "resultsdb-stg01.qa.fedoraproject.org" } - - { file: ci-resultsdb-listener.py, location: /etc/fedmsg.d/, - when: inventory_hostname != "resultsdb-stg01.qa.fedoraproject.org" } - - { file: settings.py, location: /etc/resultsdb/, - when: inventory_hostname != "resultsdb-stg01.qa.fedoraproject.org" } - - { file: cert.conf, location: /etc/httpd/conf.d/, - when: inventory_hostname != "resultsdb-stg01.qa.fedoraproject.org" } + - { file: endpoints.py, location: /etc/fedmsg.d/ } + - { file: ci-resultsdb-listener.py, location: /etc/fedmsg.d/ } + - { file: settings.py, location: /etc/resultsdb/ } + - { file: cert.conf, location: /etc/httpd/conf.d/ } + when: + - inventory_hostname != "resultsdb-stg01.qa.fedoraproject.org" notify: - reload httpd - name: Start and enable the fedmsg-hub service service: name={{ item }} enabled=yes state=started + when: + - inventory_hostname != "resultsdb-stg01.qa.fedoraproject.org" } with_items: - fedmsg-hub @@ -81,3 +87,26 @@ - config - certbot + +- name: install ci_resultsdb's + package: name={{ item }} state=present + with_items: + - python-ci-resultsdb-listener + when: deployment_type == "stg" + +- name: generate ci-resultsdb config files and override default resultsdb settings + template: src={{ item.file }} + dest={{ item.location }}/{{ item.file }} + owner=root group=root mode=0644 + with_items: + - { file: listener.cfg, location: /etc/ci-resultsdb-listener/} + - { file: config.toml, location: /etc/fedora-messaging/} + when: + - inventory_hostname == "resultsdb-stg01.qa.fedoraproject.org" + +- name: Start and enable the fedora-messaging service + service: name={{ item }} enabled=yes state=started + with_items: + - fm-consumer@config.service + when: + - inventory_hostname == "resultsdb-stg01.qa.fedoraproject.org" }