53 lines
1.4 KiB
YAML
53 lines
1.4 KiB
YAML
---
|
|
- name: Upgrade copr frontend
|
|
hosts: copr_front_dev_aws:copr_front_aws
|
|
user: root
|
|
gather_facts: true
|
|
|
|
vars:
|
|
cache_file: /var/lib/copr/.ansible-copr-frontend-version
|
|
|
|
vars_files:
|
|
- /srv/web/infra/ansible/vars/global.yml
|
|
- "/srv/private/ansible/vars.yml"
|
|
- /srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml
|
|
|
|
tasks:
|
|
- name: Generic upgrade tasks for copr servers
|
|
import_tasks: _generic_tasks.yml
|
|
|
|
- name: Check for copr-frontend update
|
|
ansible.builtin.shell: dnf clean all ; dnf check-update copr-frontend
|
|
register: frontend_has_update
|
|
changed_when: "frontend_has_update.rc != 0"
|
|
failed_when: false
|
|
|
|
- name: Make httpd stopped
|
|
service: name=httpd state=stopped
|
|
register: httpd_stopped
|
|
when: frontend_has_update.changed
|
|
|
|
- name: Upgrade copr-frontend packages
|
|
dnf:
|
|
state: latest
|
|
name:
|
|
- copr-frontend
|
|
- copr-frontend-fedora
|
|
- copr-selinux
|
|
- python3-copr-common
|
|
update_cache: true
|
|
|
|
- name: Upgrade db to head, logs in /var/log/copr-frontend/migrations.log
|
|
ansible.builtin.shell: alembic-3 upgrade head &> /var/log/copr-frontend/migrations.log
|
|
become: yes
|
|
become_user: copr-fe
|
|
args:
|
|
chdir: /usr/share/copr/coprs_frontend/
|
|
when: frontend_has_update.changed
|
|
|
|
- name: Make httpd started
|
|
service: name=httpd state=started
|
|
when: httpd_stopped.changed
|
|
|
|
handlers:
|
|
- import_tasks: "{{ handlers_path }}/restart_services.yml"
|