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
Robert Pufky 39e76e2359 Add 'latest' version to automatically download the latest gitea release.
* Versioning logic moved into separate file; versioning is determined in that
  file and appropriate facts are set.
* Removed 'gitea_dl_url' from defaults/main.yml. This is now a generated fact
  from tasks/set_version.yml.
* Remote gitea version is only checked if 'latest' is set, otherwise no logic
  change.
* 'gitea_version' used in tasks is now 'gitea_version_target'. This is the
  target install version after versioning logic is applied. No change to end
  user usage of 'gitea_version' in defaults/main.yml.
* Updated documentation with usage and removal of 'gitea_dl_url'.
2021-07-16 10:16:54 -07:00

33 lines
964 B
YAML

---
- name: Get service facts
ansible.builtin.service_facts:
- 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
ansible.builtin.command:
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_target