112 lines
3.3 KiB
YAML
112 lines
3.3 KiB
YAML
---
|
|
- name: Verify the badges backend and stop it
|
|
hosts:
|
|
- badges_backend
|
|
- badges_backend_stg
|
|
user: root
|
|
vars_files:
|
|
- /srv/web/infra/ansible/vars/global.yml
|
|
- /srv/private/ansible/vars.yml
|
|
- /srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml
|
|
handlers:
|
|
- import_tasks: "{{ handlers_path }}/restart_services.yml"
|
|
pre_tasks:
|
|
- name: tell nagios to shush
|
|
nagios: action=downtime minutes=120 service=host host={{ inventory_hostname_short }}{{ env_suffix }}
|
|
delegate_to: noc01.iad2.fedoraproject.org
|
|
ignore_errors: true
|
|
roles:
|
|
- badges/backend
|
|
tasks:
|
|
- service: name="fedmsg-hub" state=stopped
|
|
|
|
- name: Stop datagrepper
|
|
hosts:
|
|
- os_masters[0]
|
|
- os_masters_stg[0]
|
|
user: root
|
|
vars_files:
|
|
- /srv/web/infra/ansible/vars/global.yml
|
|
- /srv/private/ansible/vars.yml
|
|
- /srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml
|
|
handlers:
|
|
- import_tasks: "{{ handlers_path }}/restart_services.yml"
|
|
tasks:
|
|
- name: Scale down datagrepper to 0 pods
|
|
ansible.builtin.command: oc -n datagrepper scale dc/datagrepper --replicas=0
|
|
|
|
- name: Stop datanommer
|
|
hosts:
|
|
- os_masters[0]
|
|
- os_masters_stg[0]
|
|
user: root
|
|
vars_files:
|
|
- /srv/web/infra/ansible/vars/global.yml
|
|
- /srv/private/ansible/vars.yml
|
|
- /srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml
|
|
handlers:
|
|
- import_tasks: "{{ handlers_path }}/restart_services.yml"
|
|
tasks:
|
|
- name: Scale down datanommer to 0 pods
|
|
ansible.builtin.command: oc -n datanommer scale dc/datanommer --replicas=0
|
|
|
|
- name: Upgrade the database
|
|
role: openshift/object
|
|
object_app: datanommer
|
|
object_template: job.yml.j2
|
|
object_objectname: job.yml
|
|
|
|
- name: Wait for the db-upgrade completion
|
|
ansible.builtin.command: oc get jobs/db-upgrade -o jsonpath='{@.status.succeeded}'
|
|
register: status
|
|
until: status.stdout | int == 1
|
|
retries: 5
|
|
delay: 30
|
|
|
|
- name: Delete the job in case it finished
|
|
role: openshift/object-delete
|
|
object_delete_app: datanommer
|
|
object_delete_objecttype: job
|
|
object_delete_objectname: db-upgrade
|
|
when: status.stdout | int == 1
|
|
|
|
- name: Start the datanommer again
|
|
hosts:
|
|
- os_masters[0]
|
|
- os_masters_stg[0]
|
|
user: root
|
|
vars_files:
|
|
- /srv/web/infra/ansible/vars/global.yml
|
|
- /srv/private/ansible/vars.yml
|
|
- /srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml
|
|
tasks:
|
|
- name: Scale up datanommer pods
|
|
ansible.builtin.command: oc -n datanommer scale dc/db-datanommer --replicas=1
|
|
|
|
- name: Start the datagrepper again
|
|
hosts:
|
|
- os_masters[0]
|
|
- os_masters_stg[0]
|
|
user: root
|
|
vars_files:
|
|
- /srv/web/infra/ansible/vars/global.yml
|
|
- /srv/private/ansible/vars.yml
|
|
- /srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml
|
|
tasks:
|
|
- name: Scale up datagrepper pods
|
|
ansible.builtin.command: oc -n datagrepper scale dc/datagrepper --replicas=1
|
|
|
|
- name: Restart the last backend piece (badges)
|
|
hosts:
|
|
- badges-backend
|
|
- badges-backend-stg
|
|
user: root
|
|
vars_files:
|
|
- /srv/web/infra/ansible/vars/global.yml
|
|
- /srv/private/ansible/vars.yml
|
|
- /srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml
|
|
post_tasks:
|
|
- name: tell nagios to unshush
|
|
nagios: action=unsilence service=host host={{ inventory_hostname_short }}{{ env_suffix }}
|
|
delegate_to: noc01.iad2.fedoraproject.org
|
|
ignore_errors: true
|