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
|
2022-01-23 14:08:46 +01:00
|
|
|
become: true
|
2021-03-22 21:21:25 +01:00
|
|
|
ansible.builtin.command:
|
2022-01-23 18:03:07 +01:00
|
|
|
cmd: "sudo -u {{ gitea_user }} gitea dump -c /etc/gitea/gitea.ini"
|
2021-02-13 05:32:27 +01:00
|
|
|
chdir: "{{ gitea_backup_location }}"
|
2022-03-27 05:19:36 +02:00
|
|
|
changed_when: true
|
2021-02-13 05:32:27 +01:00
|
|
|
when:
|
|
|
|
- ansible_facts.services["gitea.service"] is defined
|
|
|
|
- ansible_facts.services["gitea.service"].state == "running"
|
2021-07-16 02:43:58 +02:00
|
|
|
- gitea_active_version.stdout != gitea_version_target
|