From 94e353f1f03ac306a37151db74998c46f842d986 Mon Sep 17 00:00:00 2001 From: Jeremy Cline Date: Thu, 9 Feb 2017 16:29:48 +0000 Subject: [PATCH] Add a playbook for upgrading Anitya Signed-off-by: Jeremy Cline --- playbooks/manual/upgrade/anitya.yml | 70 +++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 playbooks/manual/upgrade/anitya.yml diff --git a/playbooks/manual/upgrade/anitya.yml b/playbooks/manual/upgrade/anitya.yml new file mode 100644 index 0000000000..3c2b68bd0c --- /dev/null +++ b/playbooks/manual/upgrade/anitya.yml @@ -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