1
1
Fork 0
mirror of https://github.com/roles-ansible/ansible_role_gitea.git synced 2024-08-16 11:39:50 +02:00
ansible_role_gitea/tasks/backup.yml
mar1ad 9b6de1fcdd Fix newest ansible-lint issues
* schema: 'AIX' was expected (schema[meta])

This was unclear but specifying platform version "all" as a list entry, solved it

* schema: 2.11 is not of type 'string' (schema[meta])
* schema: Additional properties are not allowed ('github_branch' was unexpected) (schema[meta])
* unnamed-task: All tasks should be named
2022-06-08 11:20:53 +02:00

45 lines
1.3 KiB
YAML

---
- name: Get service facts
ansible.builtin.service_facts:
- name: Backup block
block:
- name: Stopping gitea before upgrade
become: true
ansible.builtin.systemd:
name: gitea
state: stopped
when: ansible_service_mgr == "systemd"
- name: "Create backup directory"
become: true
ansible.builtin.file:
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
become: true
ansible.builtin.command:
cmd: "sudo -u {{ gitea_user }} /usr/local/bin/gitea dump -c /etc/gitea/gitea.ini"
chdir: "{{ gitea_backup_location }}"
changed_when: true
rescue:
- name: Starting gitea because backup failed
become: true
ansible.builtin.systemd:
name: gitea
state: stopped
when: ansible_service_mgr == "systemd"
- name: print updateing error
ansible.builtin.debug:
msg: "failed to backup gitea"
when:
- ansible_facts.services["gitea.service"] is defined
- ansible_facts.services["gitea.service"].state == "running"
- gitea_active_version.stdout != gitea_version_target