Create manual playbooks for upgrading Copr instances

There is a problem with our current playbooks, that they can be
executed automatically without us knowing about it. That is an issue
particularly during release process because we can prepare new
packages into infra-tags repo or bodhi and a nightly reprovision
can upgrade to them outside of an outage window or any of us being
prepared for it.

Therefore `groups/copr-*.yml` playbooks *should not* upgrade any
packages, but only ensure, that those packages are installed. For
upgrade, there should be separate `manual/copr/copr-*-upgrade.yml`
playbooks. Because they are located under `manual` directory, it
is secured, that they can't be run automatically.
This commit is contained in:
Jakub Kadlčík 2019-04-23 12:05:49 +02:00
parent 8fb5f0aca9
commit 96de11a1bf
8 changed files with 86 additions and 11 deletions

View file

@ -1,6 +1,6 @@
---
- name: upgrade copr frontend
hosts: copr-front-stg
- name: upgrade copr backend
hosts: copr-back-dev:copr-back-stg:copr-back
user: root
gather_facts: True
@ -9,12 +9,13 @@
- "/srv/private/ansible/vars.yml"
- /srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml
roles:
- copr/frontend
tasks:
- name: Upgrade copr-frontend package
dnf: state=latest pkg=copr-frontend
- name: Upgrade copr-backend packages
dnf:
state: latest
name:
- copr-backend
- copr-selinux
handlers:
- import_tasks: "{{ handlers_path }}/restart_services.yml"

View file

@ -0,0 +1,23 @@
---
- name: upgrade copr distgit
hosts: copr-dist-git-dev:copr-dist-git-stg:copr-dist-git
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
tasks:
- name: Upgrade copr-distgit packages
dnf:
state: latest
name:
- dist-git
- dist-git-selinux
- copr-dist-git
- copr-selinux
handlers:
- import_tasks: "{{ handlers_path }}/restart_services.yml"

View file

@ -0,0 +1,28 @@
---
- name: upgrade copr frontend
hosts: copr-front-dev:copr-front
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
tasks:
- name: Upgrade copr-frontend packages
dnf:
state: latest
name:
- copr-frontend
- copr-selinux
- name: upgrade db to head
command: alembic-3 upgrade head
become: yes
become_user: copr-fe
args:
chdir: /usr/share/copr/coprs_frontend/
handlers:
- import_tasks: "{{ handlers_path }}/restart_services.yml"

View file

@ -0,0 +1,23 @@
---
- name: upgrade copr keygen
hosts: copr-keygen-dev:copr-keygen-stg:copr-keygen
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
tasks:
- name: Upgrade copr-keygen packages
dnf:
state: latest
name:
- copr-keygen
- copr-selinux
notify:
- restart haveged
handlers:
- import_tasks: "{{ handlers_path }}/restart_services.yml"

View file

@ -11,7 +11,7 @@
- name: install copr-backend and copr-selinux
dnf:
state: latest
state: present
name: copr-backend
- name: add additional packages for copr-backend

View file

@ -21,7 +21,7 @@
- name: install latest dist-git and copr-dist-git
dnf:
state: latest
state: present
name:
- dist-git
- dist-git-selinux

View file

@ -16,7 +16,7 @@
- name: install copr-frontend and copr-selinux
dnf:
state: latest
state: present
name:
- copr-frontend
- copr-selinux

View file

@ -11,7 +11,7 @@
#when: devel
- name: install copr-keygen
dnf: state=latest name=copr-keygen
dnf: state=present name=copr-keygen
notify:
- restart haveged