2021-02-13 05:32:27 +01:00
|
|
|
---
|
|
|
|
- name: Get service facts
|
2021-03-22 21:21:25 +01:00
|
|
|
ansible.builtin.service_facts:
|
2021-02-13 05:32:27 +01:00
|
|
|
|
|
|
|
- block:
|
|
|
|
- name: Stopping gitea before upgrade
|
2021-03-22 21:21:25 +01:00
|
|
|
become: true
|
|
|
|
ansible.builtin.systemd:
|
2021-02-13 05:32:27 +01:00
|
|
|
name: gitea
|
|
|
|
state: stopped
|
2021-03-22 21:21:25 +01:00
|
|
|
when: ansible_service_mgr == "systemd"
|
2021-02-13 05:32:27 +01:00
|
|
|
|
|
|
|
- name: "Create backup directory"
|
2021-03-22 21:21:25 +01:00
|
|
|
become: true
|
|
|
|
ansible.builtin.file:
|
2021-02-13 05:32:27 +01:00
|
|
|
path: "{{ item }}"
|
|
|
|
state: directory
|
|
|
|
owner: "{{ gitea_user }}"
|
|
|
|
group: "{{ gitea_group }}"
|
|
|
|
mode: 'u=rwx,g=rx,o='
|
|
|
|
with_items:
|
|
|
|
- "{{ gitea_backup_location }}"
|
|
|
|
|
|
|
|
- name: Backing up gitea before upgrade
|
2021-03-22 21:21:25 +01:00
|
|
|
ansible.builtin.command:
|
2021-02-13 05:32:27 +01:00
|
|
|
cmd: "gitea dump -c /etc/gitea/gitea.ini"
|
|
|
|
chdir: "{{ gitea_backup_location }}"
|
|
|
|
become: true
|
|
|
|
become_user: "{{ gitea_user }}"
|
|
|
|
when:
|
|
|
|
- ansible_facts.services["gitea.service"] is defined
|
|
|
|
- ansible_facts.services["gitea.service"].state == "running"
|
|
|
|
- gitea_active_version.stdout != gitea_version
|