Add a playbook for upgrading Anitya

Signed-off-by: Jeremy Cline <jeremy@jcline.org>
This commit is contained in:
Jeremy Cline 2017-02-09 16:29:48 +00:00
parent 1a8660fe36
commit 94e353f1f0

View file

@ -0,0 +1,70 @@
- name: push packages out
hosts: anitya-frontend01:anitya-backend01
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: clean all metadata {%if testing%}(with infrastructure-testing on){%endif%}
command: yum clean all {%if testing%} --enablerepo=infrastructure-testing {%endif%}
check_mode: no
- name: yum update anitya packages from main repo
yum: name="anitya" state=latest
- name: yum update anitya packages from testing repo
yum: name="anitya" state=latest enablerepo=infrastructure-testing
when: testing
- name: verify the frontend
hosts: anitya-frontend01
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"
pre_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
roles:
- anitya/frontend
- anitya/fedmsg
post_tasks:
- 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: verify the backend and then upgrade the db
hosts: anitya-backend01
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"
pre_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
roles:
- anitya/backend
- anitya/fedmsg
tasks:
- name: Upgrade the database
command: /usr/bin/alembic -c /usr/share/anitya/alembic.ini upgrade head
args:
chdir: /usr/share/anitya/
when: inventory_hostname.startswith('anitya-backend01')
post_tasks:
- 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