openqa/dispatcher: set up fedora-messaging restart handlers

This should handle consumer service restarts elegantly. I hope.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
This commit is contained in:
Adam Williamson 2019-06-17 17:05:23 -07:00
parent 6360a231cb
commit 3b6e6fea7a
2 changed files with 30 additions and 21 deletions

View file

@ -0,0 +1,18 @@
# Restart handler for our fedora-messaging consumers
- name: Conditionally restart openQA scheduler consumer
command: /usr/local/bin/conditional-restart.sh fm-consumer@fedora_openqa_scheduler
listen:
- restart openqa consumers
- restart openqa scheduler consumer
- name: Conditionally restart openQA ResultsDB reporter consumer
command: /usr/local/bin/conditional-restart.sh fm-consumer@fedora_openqa_resultsdb_reporter
listen:
- restart openqa consumers
- restart openqa resultsdb consumer
- name: Conditionally restart openQA wiki reporter consumer
command: /usr/local/bin/conditional-restart.sh fm-consumer@fedora_openqa_wiki_reporter
listen:
- restart openqa consumers
- restart openqa wiki consumer

View file

@ -216,8 +216,8 @@
args: args:
chdir: /root/fedora_openqa chdir: /root/fedora_openqa
when: "gittools is changed or not insttools.stat.exists" when: "gittools is changed or not insttools.stat.exists"
# notify: notify:
# - restart fedmsg-hub - restart openqa consumers
# For now, we only have enough ppc64/aarch64 workers for one instance, # For now, we only have enough ppc64/aarch64 workers for one instance,
# so we have a variant WANTED file that we deploy based on a config # so we have a variant WANTED file that we deploy based on a config
@ -225,8 +225,8 @@
- name: Install extra arch WANTED images config if enabled - name: Install extra arch WANTED images config if enabled
copy: src=images.json.extraarches dest=/etc/fedora-openqa/images.json copy: src=images.json.extraarches dest=/etc/fedora-openqa/images.json
when: openqa_extraarches when: openqa_extraarches
# notify: notify:
# - restart fedmsg-hub - restart openqa scheduler consumer
- name: openQA client config - name: openQA client config
template: src=client.conf.j2 dest=/etc/openqa/client.conf owner=root group=fedmsg mode=0640 template: src=client.conf.j2 dest=/etc/openqa/client.conf owner=root group=fedmsg mode=0640
@ -238,8 +238,8 @@
- name: Write schedule.conf - name: Write schedule.conf
template: src=schedule.conf.j2 dest=/etc/fedora-openqa/schedule.conf owner=root group=root mode=0644 template: src=schedule.conf.j2 dest=/etc/fedora-openqa/schedule.conf owner=root group=root mode=0644
# notify: notify:
# - restart fedmsg-hub - restart openqa consumers
tags: tags:
- config - config
@ -324,21 +324,24 @@
- name: Configure fedora-messaging scheduler - name: Configure fedora-messaging scheduler
template: src=fedora_openqa_scheduler.toml.j2 dest=/etc/fedora-messaging/fedora_openqa_scheduler.toml owner=root group=root mode=0640 template: src=fedora_openqa_scheduler.toml.j2 dest=/etc/fedora-messaging/fedora_openqa_scheduler.toml owner=root group=root mode=0640
register: fmscheduler notify:
- restart openqa scheduler consumer
when: "openqa_amqp_scheduler_queue is defined" when: "openqa_amqp_scheduler_queue is defined"
tags: tags:
- config - config
- name: Configure fedora-messaging wiki reporter - name: Configure fedora-messaging wiki reporter
template: src=fedora_openqa_wiki_reporter.toml.j2 dest=/etc/fedora-messaging/fedora_openqa_wiki_reporter.toml owner=root group=root mode=0640 template: src=fedora_openqa_wiki_reporter.toml.j2 dest=/etc/fedora-messaging/fedora_openqa_wiki_reporter.toml owner=root group=root mode=0640
register: fmwiki notify:
- restart openqa wiki consumer
when: "openqa_amqp_wiki_reporter_queue is defined" when: "openqa_amqp_wiki_reporter_queue is defined"
tags: tags:
- config - config
- name: Configure fedora-messaging ResultsDB reporter - name: Configure fedora-messaging ResultsDB reporter
template: src=fedora_openqa_resultsdb_reporter.toml.j2 dest=/etc/fedora-messaging/fedora_openqa_resultsdb_reporter.toml owner=root group=root mode=0640 template: src=fedora_openqa_resultsdb_reporter.toml.j2 dest=/etc/fedora-messaging/fedora_openqa_resultsdb_reporter.toml owner=root group=root mode=0640
register: fmresultsdb notify:
- restart openqa resultsdb consumer
when: "openqa_amqp_resultsdb_reporter_queue is defined" when: "openqa_amqp_resultsdb_reporter_queue is defined"
tags: tags:
- config - config
@ -355,18 +358,6 @@
service: name=fm-consumer@fedora_openqa_resultsdb_reporter enabled=yes state=started service: name=fm-consumer@fedora_openqa_resultsdb_reporter enabled=yes state=started
when: "openqa_amqp_resultsdb_reporter_queue is defined" when: "openqa_amqp_resultsdb_reporter_queue is defined"
- name: Restart fedora-messaging scheduler service
command: /usr/local/bin/conditional-restart.sh fm-consumer@fedora_openqa_scheduler
when: "fmscheduler is changed"
- name: Restart fedora-messaging wiki reporter service
command: /usr/local/bin/conditional-restart.sh fm-consumer@fedora_openqa_wiki_reporter
when: "fmwiki is changed"
- name: Restart fedora-messaging ResultsDB reporter service
command: /usr/local/bin/conditional-restart.sh fm-consumer@fedora_openqa_resultsdb_reporter
when: "fmresultsdb is changed"
- name: Set up cron job to schedule live-respins jobs - name: Set up cron job to schedule live-respins jobs
copy: src=schedule-live-respins.cron dest=/etc/cron.hourly/schedule-live-respins owner=root group=root mode=0755 copy: src=schedule-live-respins.cron dest=/etc/cron.hourly/schedule-live-respins owner=root group=root mode=0755
tags: tags: