openqa playbook: rearrange, drop queue 'when' conditionals

This was kinda...a mess. I had just dumped the queue creation
in the staging NFS client play for some reason, and it still
had 'when' conditionals from when I only wanted the messaging
stuff to happen on staging. This cleans all that up and creates
separate plays for the queue creation and NFS client stuff.
The plays should also be in the right *order* now, so we get
the NFS mounts created and the AMQP queues set up *before* we
run the roles.
This commit is contained in:
Adam Williamson 2019-06-18 17:22:10 -07:00
parent 8c41cdf9ac
commit 31e2e85d8c

View file

@ -1,6 +1,6 @@
- import_playbook: "/srv/web/infra/ansible/playbooks/include/virt-create.yml myhosts=openqa:openqa_stg" - import_playbook: "/srv/web/infra/ansible/playbooks/include/virt-create.yml myhosts=openqa:openqa_stg"
- name: setup base openqa host - name: setup base openQA host
hosts: openqa:openqa_stg hosts: openqa:openqa_stg
user: root user: root
gather_facts: True gather_facts: True
@ -32,7 +32,7 @@
handlers: handlers:
- import_tasks: "{{ handlers_path }}/restart_services.yml" - import_tasks: "{{ handlers_path }}/restart_services.yml"
- name: configure openQA - name: configure fedora-messaging queues on openQA servers
hosts: openqa:openqa_stg hosts: openqa:openqa_stg
user: root user: root
gather_facts: True gather_facts: True
@ -42,32 +42,7 @@
- "/srv/private/ansible/vars.yml" - "/srv/private/ansible/vars.yml"
- /srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml - /srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml
# relvalconsumer and autocloudreporter aren't particularly related
# to openQA in any way, we just put those role on these boxes. There's
# nowhere more obviously correct for rvc and acr should be on an
# Autocloud box but I don't know if they're authed for RDB.
roles: roles:
- { role: openqa/server, tags: ['openqa_server'] }
- { role: openqa/dispatcher, tags: ['openqa_dispatcher'] }
- { role: check-compose, tags: ['check-compose'] }
- { role: fedmsg/base, tags: ['fedmsg_base', 'fedmsg'] }
- { role: fedmsg/hub, tags: ['fedmsg_hub', 'fedmsg'] }
- { role: relvalconsumer, tags: ['relvalconsumer'] }
- { role: autocloudreporter, tags: ['autocloudreporter'] }
handlers:
- import_tasks: "{{ handlers_path }}/restart_services.yml"
- name: set up openQA server data NFS mounts (staging)
hosts: openqa_stg
vars_files:
- /srv/web/infra/ansible/vars/global.yml
- "/srv/private/ansible/vars.yml"
- /srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml
roles:
# fedora-messaging queue/user setup
- role: rabbit/queue - role: rabbit/queue
username: "openqa" username: "openqa"
queue_name: "openqa{{ openqa_env_suffix }}_scheduler" queue_name: "openqa{{ openqa_env_suffix }}_scheduler"
@ -81,7 +56,6 @@
env: "production" env: "production"
env_suffix: "" env_suffix: ""
tags: ['rabbit'] tags: ['rabbit']
when: deployment_type == "stg"
- role: rabbit/queue - role: rabbit/queue
username: "openqa{{ openqa_env_suffix }}" username: "openqa{{ openqa_env_suffix }}"
queue_name: "openqa{{ openqa_env_suffix }}_resultsdb_reporter" queue_name: "openqa{{ openqa_env_suffix }}_resultsdb_reporter"
@ -93,7 +67,6 @@
env: "{{ openqa_env }}" env: "{{ openqa_env }}"
env_suffix: "{{ openqa_env_suffix }}" env_suffix: "{{ openqa_env_suffix }}"
tags: ['rabbit'] tags: ['rabbit']
when: deployment_type == "stg"
- role: rabbit/queue - role: rabbit/queue
username: "openqa{{ openqa_env_suffix }}" username: "openqa{{ openqa_env_suffix }}"
queue_name: "openqa{{ openqa_env_suffix }}_wiki_reporter" queue_name: "openqa{{ openqa_env_suffix }}_wiki_reporter"
@ -105,7 +78,6 @@
env: "{{ openqa_env }}" env: "{{ openqa_env }}"
env_suffix: "{{ openqa_env_suffix }}" env_suffix: "{{ openqa_env_suffix }}"
tags: ['rabbit'] tags: ['rabbit']
when: deployment_type == "stg"
# relvalconsumer queue, we still use openqa auth for this as it's # relvalconsumer queue, we still use openqa auth for this as it's
# easy that way # easy that way
- role: rabbit/queue - role: rabbit/queue
@ -119,7 +91,16 @@
env: "production" env: "production"
env_suffix: "" env_suffix: ""
tags: ['rabbit'] tags: ['rabbit']
# nfs client setup
- name: set up openQA server data NFS mounts (staging)
hosts: openqa_stg
vars_files:
- /srv/web/infra/ansible/vars/global.yml
- "/srv/private/ansible/vars.yml"
- /srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml
roles:
- role: nfs/client - role: nfs/client
mnt_dir: '/var/lib/openqa/testresults' mnt_dir: '/var/lib/openqa/testresults'
nfs_src_dir: 'fedora_openqa_stg/testresults' nfs_src_dir: 'fedora_openqa_stg/testresults'
@ -156,3 +137,29 @@
handlers: handlers:
- import_tasks: "{{ handlers_path }}/restart_services.yml" - import_tasks: "{{ handlers_path }}/restart_services.yml"
- name: configure openQA
hosts: openqa:openqa_stg
user: root
gather_facts: True
vars_files:
- /srv/web/infra/ansible/vars/global.yml
- "/srv/private/ansible/vars.yml"
- /srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml
# relvalconsumer and autocloudreporter aren't particularly related
# to openQA in any way, we just put those role on these boxes. There's
# nowhere more obviously correct for rvc and acr should be on an
# Autocloud box but I don't know if they're authed for RDB.
roles:
- { role: openqa/server, tags: ['openqa_server'] }
- { role: openqa/dispatcher, tags: ['openqa_dispatcher'] }
- { role: check-compose, tags: ['check-compose'] }
- { role: fedmsg/base, tags: ['fedmsg_base', 'fedmsg'] }
- { role: fedmsg/hub, tags: ['fedmsg_hub', 'fedmsg'] }
- { role: relvalconsumer, tags: ['relvalconsumer'] }
- { role: autocloudreporter, tags: ['autocloudreporter'] }
handlers:
- import_tasks: "{{ handlers_path }}/restart_services.yml"