71ea49b7ac
* create backup direcotry create a backup folder and move the gitea backup to backup.yml * make the backup on update optional Documentation and introduction of the variable `gitea_backup_on_upgrade: false` * change become_method to sudo change become_method to sudo as suggested by @wzzrd. removed become_flags. * Full path to gitea binary in backup task. thanks to @wzzrd
30 lines
825 B
YAML
30 lines
825 B
YAML
---
|
|
- name: Get service facts
|
|
service_facts:
|
|
|
|
- block:
|
|
- name: Stopping gitea before upgrade
|
|
service:
|
|
name: gitea
|
|
state: stopped
|
|
|
|
- name: "Create backup directory"
|
|
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
|
|
command:
|
|
cmd: "/usr/local/bin/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
|