Move some tasks from gitea to gitea backup
This commit is contained in:
parent
c30e388349
commit
05a29560af
2 changed files with 28 additions and 25 deletions
25
roles/gitea/tasks/backup.yml
Normal file
25
roles/gitea/tasks/backup.yml
Normal file
|
@ -0,0 +1,25 @@
|
|||
---
|
||||
- name: Copy gitea_backup.sh script
|
||||
become: true
|
||||
ansible.builtin.template:
|
||||
src: gitea_backup.sh.j2
|
||||
dest: /usr/local/bin/gitea_backup.sh
|
||||
owner: git
|
||||
group: git
|
||||
mode: 0775
|
||||
|
||||
- name: Create gitea-dumps directory
|
||||
become: true
|
||||
ansible.builtin.file:
|
||||
path: /var/lib/gitea/gitea-dumps
|
||||
state: directory
|
||||
owner: git
|
||||
group: git
|
||||
mode: 0755
|
||||
|
||||
- name: Setup gitea-backup crontab
|
||||
become: true
|
||||
ansible.builtin.copy:
|
||||
src: gitea-backup.cron
|
||||
dest: /etc/cron.d/gitea-backup
|
||||
mode: 0644
|
|
@ -14,6 +14,9 @@
|
|||
- name: Include binary tasks
|
||||
ansible.builtin.include_tasks: binary.yml
|
||||
|
||||
- name: Include backup tasks
|
||||
ansible.builtin.include_tasks: backup.yml
|
||||
|
||||
- name: Copy /etc/systemd/system/gitea.service
|
||||
become: true
|
||||
ansible.builtin.copy:
|
||||
|
@ -51,24 +54,6 @@
|
|||
- name: Include fail2ban tasks
|
||||
ansible.builtin.include_tasks: fail2ban.yml
|
||||
|
||||
- name: Copy gitea_backup.sh script
|
||||
become: true
|
||||
ansible.builtin.template:
|
||||
src: gitea_backup.sh.j2
|
||||
dest: /usr/local/bin/gitea_backup.sh
|
||||
owner: git
|
||||
group: git
|
||||
mode: 0775
|
||||
|
||||
- name: Create gitea-dumps directory
|
||||
become: true
|
||||
ansible.builtin.file:
|
||||
path: /var/lib/gitea/gitea-dumps
|
||||
state: directory
|
||||
owner: git
|
||||
group: git
|
||||
mode: 0755
|
||||
|
||||
- name: Set today's string for zipfile name
|
||||
ansible.builtin.set_fact:
|
||||
today: "{{ ansible_date_time.year }}{{ ansible_date_time.month }}{{ ansible_date_time.day }}"
|
||||
|
@ -102,13 +87,6 @@
|
|||
cmd: "/var/lib/gitea/gitea_backup.sh restore /var/lib/gitea/gitea-dumps/gitea-dump-{{ today }}.zip"
|
||||
creates: /var/lib/gitea/gitea-repositories # when this dir exists, the command won't run, so we don't overwrite existing repos
|
||||
|
||||
- name: Setup gitea-backup crontab
|
||||
become: true
|
||||
ansible.builtin.copy:
|
||||
src: gitea-backup.cron
|
||||
dest: /etc/cron.d/gitea-backup
|
||||
mode: 0644
|
||||
|
||||
- name: Setup logrotate for gitea logs
|
||||
become: true
|
||||
ansible.builtin.copy:
|
||||
|
|
Loading…
Reference in a new issue