Replace forgejo-backup cron by borgmatic cron
This commit is contained in:
parent
466c4509df
commit
6896dcf819
4 changed files with 19 additions and 19 deletions
|
@ -60,3 +60,19 @@
|
||||||
cmd: borgmatic init --encryption repokey
|
cmd: borgmatic init --encryption repokey
|
||||||
register: borgmatic_init
|
register: borgmatic_init
|
||||||
changed_when: borgmatic_init.stderr != ''
|
changed_when: borgmatic_init.stderr != ''
|
||||||
|
|
||||||
|
- name: Stop and disable borgmatic timer
|
||||||
|
become: true
|
||||||
|
ansible.builtin.systemd:
|
||||||
|
name: borgmatic.timer
|
||||||
|
state: stopped
|
||||||
|
enabled: false
|
||||||
|
|
||||||
|
- name: Copy borgmatic cron
|
||||||
|
become: true
|
||||||
|
ansible.builtin.template:
|
||||||
|
src: cron.d/borgmatic.j2
|
||||||
|
dest: /etc/cron.d/borgmatic
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: 0644
|
||||||
|
|
3
roles/borgmatic/templates/cron.d/borgmatic.j2
Normal file
3
roles/borgmatic/templates/cron.d/borgmatic.j2
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
# {{ ansible_managed }}
|
||||||
|
|
||||||
|
0 3 * * * root /usr/bin/borgmatic
|
|
@ -17,19 +17,3 @@
|
||||||
owner: git
|
owner: git
|
||||||
group: git
|
group: git
|
||||||
mode: 0755
|
mode: 0755
|
||||||
|
|
||||||
- name: Create forgejo-backup log directory
|
|
||||||
become: true
|
|
||||||
ansible.builtin.file:
|
|
||||||
path: "{{ forgejo_backup_log_dir }}"
|
|
||||||
state: directory
|
|
||||||
owner: git
|
|
||||||
group: git
|
|
||||||
mode: 0755
|
|
||||||
|
|
||||||
- name: Setup forgejo-backup crontab
|
|
||||||
become: true
|
|
||||||
ansible.builtin.template:
|
|
||||||
src: cron.d/forgejo-backup.j2
|
|
||||||
dest: /etc/cron.d/forgejo-backup
|
|
||||||
mode: 0644
|
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
# {{ ansible_managed }}
|
|
||||||
|
|
||||||
0 5 * * * git USER=git /usr/local/bin/forgejo-backup.sh backup >> {{ forgejo_backup_log_dir }}/backup.log 2>&1 && USER=git /usr/local/bin/forgejo-backup.sh prune 2 >> {{ forgejo_backup_log_dir }}/prune.log 2>&1
|
|
Loading…
Add table
Reference in a new issue