copr: frontend: try to make upgrade script idempotent
https://pagure.io/copr/copr/issue/1138
This commit is contained in:
parent
009b6a28a5
commit
96e1c7382a
1 changed files with 11 additions and 0 deletions
|
@ -4,6 +4,9 @@
|
||||||
user: root
|
user: root
|
||||||
gather_facts: True
|
gather_facts: True
|
||||||
|
|
||||||
|
vars:
|
||||||
|
cache_file: /var/lib/copr/.ansible-copr-frontend-version
|
||||||
|
|
||||||
vars_files:
|
vars_files:
|
||||||
- /srv/web/infra/ansible/vars/global.yml
|
- /srv/web/infra/ansible/vars/global.yml
|
||||||
- "/srv/private/ansible/vars.yml"
|
- "/srv/private/ansible/vars.yml"
|
||||||
|
@ -19,12 +22,20 @@
|
||||||
- python3-copr-common
|
- python3-copr-common
|
||||||
update_cache: true
|
update_cache: true
|
||||||
|
|
||||||
|
- package_facts: manager=auto
|
||||||
|
|
||||||
|
- name: cache the new package version
|
||||||
|
copy: content="{{ ansible_facts.packages['copr-frontend'][0].version }}"
|
||||||
|
dest="{{ cache_file }}"
|
||||||
|
register: version_file
|
||||||
|
|
||||||
- name: upgrade db to head
|
- name: upgrade db to head
|
||||||
command: alembic-3 upgrade head
|
command: alembic-3 upgrade head
|
||||||
become: yes
|
become: yes
|
||||||
become_user: copr-fe
|
become_user: copr-fe
|
||||||
args:
|
args:
|
||||||
chdir: /usr/share/copr/coprs_frontend/
|
chdir: /usr/share/copr/coprs_frontend/
|
||||||
|
when: version_file.changed
|
||||||
|
|
||||||
handlers:
|
handlers:
|
||||||
- import_tasks: "{{ handlers_path }}/restart_services.yml"
|
- import_tasks: "{{ handlers_path }}/restart_services.yml"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue