mirror of
https://github.com/roles-ansible/ansible_role_gitea.git
synced 2024-08-16 11:39:50 +02:00
create backup direcotry
create a backup folder and move the gitea backup to backup.yml
This commit is contained in:
parent
56375819a7
commit
0ffd14ccf0
4 changed files with 39 additions and 23 deletions
|
@ -86,3 +86,5 @@ gitea_repo_exclude_vendored: true
|
||||||
gitea_repo_indexer_max_file_size: 1048576
|
gitea_repo_indexer_max_file_size: 1048576
|
||||||
|
|
||||||
gitea_extra_config: ""
|
gitea_extra_config: ""
|
||||||
|
|
||||||
|
gitea_backup_location: "{{ gitea_home }}/backups/"
|
||||||
|
|
32
tasks/backup.yml
Normal file
32
tasks/backup.yml
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
---
|
||||||
|
- 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: "gitea dump -c /etc/gitea/gitea.ini"
|
||||||
|
chdir: "{{ gitea_backup_location }}"
|
||||||
|
become: true
|
||||||
|
become_method: su
|
||||||
|
become_user: "{{ gitea_user }}"
|
||||||
|
become_flags: "-s /bin/sh"
|
||||||
|
when:
|
||||||
|
- ansible_facts.services["gitea.service"] is defined
|
||||||
|
- ansible_facts.services["gitea.service"].state == "running"
|
||||||
|
- gitea_active_version.stdout != gitea_version
|
|
@ -18,28 +18,6 @@
|
||||||
retries: 5
|
retries: 5
|
||||||
delay: 2
|
delay: 2
|
||||||
|
|
||||||
- name: Get service facts
|
|
||||||
service_facts:
|
|
||||||
|
|
||||||
- block:
|
|
||||||
- name: Stopping gitea before upgrade
|
|
||||||
service:
|
|
||||||
name: gitea
|
|
||||||
state: stopped
|
|
||||||
|
|
||||||
- name: Backing up gitea before upgrade
|
|
||||||
command:
|
|
||||||
cmd: "gitea dump -c /etc/gitea/gitea.ini"
|
|
||||||
chdir: /var/backups/
|
|
||||||
become: true
|
|
||||||
become_method: su
|
|
||||||
become_user: "{{ gitea_user }}"
|
|
||||||
become_flags: "-s /bin/sh"
|
|
||||||
when:
|
|
||||||
- ansible_facts.services["gitea.service"] is defined
|
|
||||||
- ansible_facts.services["gitea.service"].state == "running"
|
|
||||||
- gitea_active_version.stdout != gitea_version
|
|
||||||
|
|
||||||
- block:
|
- block:
|
||||||
- name: Download gitea archive
|
- name: Download gitea archive
|
||||||
get_url:
|
get_url:
|
||||||
|
|
|
@ -17,7 +17,11 @@
|
||||||
failed_when: false
|
failed_when: false
|
||||||
when: gitea_version_check|bool
|
when: gitea_version_check|bool
|
||||||
|
|
||||||
- include: install.yml
|
- name: backup gitea before update
|
||||||
|
include_tasks: backup.yml
|
||||||
|
|
||||||
|
- name: install or update gitea
|
||||||
|
include_tasks: install.yml
|
||||||
|
|
||||||
- include: create_user.yml
|
- include: create_user.yml
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue