Add a pdc upgrade playbook.

This commit is contained in:
Ralph Bean 2016-01-27 16:11:06 +00:00
parent e66b60a56c
commit ab47adadde

View file

@ -0,0 +1,83 @@
- name: push packages out
hosts: pdc-backend;pdc-backend-stg;pdc-web;pdc-web-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
tasks:
- name: clean all metadata
command: yum clean all
always_run: yes
- name: yum update PDC packages
yum: name="pdc-*" state=latest
- name: verify the backend, and stop it
hosts: pdc-backend;pdc-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:
- include: "{{ handlers }}/restart_services.yml"
roles:
- pdc/backend
post_tasks:
- name: tell nagios to shush w.r.t. the backend
nagios: action=downtime minutes=15 service=host host={{ inventory_hostname_short }}{{ env_suffix }}
delegate_to: noc01.phx2.fedoraproject.org
ignore_errors: true
- name: Stop the pdc-updater backend
service: name="fedmsg-hub" state=stopped
- name: verify the frontend, stop it, upgrade the db, and restart it
hosts: pdc-web;pdc-web-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:
- include: "{{ handlers }}/restart_services.yml"
roles:
- pdc/frontend
post_tasks:
- name: tell nagios to shush w.r.t. the frontend
nagios: action=downtime minutes=15 service=host host={{ inventory_hostname_short }}{{ env_suffix }}
delegate_to: noc01.phx2.fedoraproject.org
ignore_errors: true
- service: name="httpd" state=stopped
- name: Upgrade the database, only on the primary web node.
command: python /usr/lib/python2.7/site-packages/pdc/manage.py syncdb --noinput
args:
chdir: /usr/lib/python2.7/site-packages/pdc/
when: inventory_shortname == 'pdc-web01'
- service: name="httpd" state=started
- name: tell nagios to unshush w.r.t. the frontend
nagios: action=unsilence service=host host={{ inventory_hostname_short }}{{ env_suffix }}
delegate_to: noc01.phx2.fedoraproject.org
ignore_errors: true
- name: restart the backend
hosts: pdc-backend;pdc-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:
- include: "{{ handlers }}/restart_services.yml"
tasks:
- name: And... start the backend again
service: name="fedmsg-hub" state=started
- name: tell nagios to unshush w.r.t. the backend
nagios: action=unsilence service=host host={{ inventory_hostname_short }}{{ env_suffix }}
delegate_to: noc01.phx2.fedoraproject.org
ignore_errors: true