align borg and burp folders to backup, switch to systemd for scheduling
This commit is contained in:
@@ -1,10 +1,16 @@
|
||||
- name: Deploy cronjob backup_tout_court
|
||||
vars:
|
||||
minutes: "{{ 59 | random(seed=inventory_hostname) }}"
|
||||
cron:
|
||||
name: backup
|
||||
cron_file: backup
|
||||
user: root
|
||||
hour: "2"
|
||||
minute: "{{ minutes }}"
|
||||
job: "{{ borg_script_dir }}/borg.sh"
|
||||
- name: Deploy systemd service and timer unit files
|
||||
ansible.builtin.template:
|
||||
src: "{{ item }}"
|
||||
dest: /etc/systemd/system/
|
||||
notify: reload systemd
|
||||
loop:
|
||||
- borg_backup.service
|
||||
- borg_backup.timer
|
||||
|
||||
- ansible.builtin.meta: flush_handlers
|
||||
|
||||
- name: enable and start timer
|
||||
ansible.builtin.systemd:
|
||||
name: borg_backup.timer
|
||||
state: started
|
||||
enabled: true
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
path: /root/.ssh
|
||||
mode: 0700
|
||||
state: directory
|
||||
- name: .ssh/confi
|
||||
- name: .ssh/config
|
||||
ansible.builtin.copy:
|
||||
dest: /root/.ssh/config
|
||||
content: |
|
||||
@@ -14,11 +14,9 @@
|
||||
Port 2222
|
||||
|
||||
- name: get borg binary
|
||||
get_url:
|
||||
dest: /usr/bin/borg
|
||||
owner: root
|
||||
mode: "0755"
|
||||
url: https://github.com/borgbackup/borg/releases/download/{{ borg_release }}/borg-linuxnew64
|
||||
ansible.builtin.package:
|
||||
name: borgbackup
|
||||
state: present
|
||||
|
||||
- name: ensure /root/bin exists
|
||||
ansible.builtin.file:
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
path: "{{ borg_remote_dir }}{{ inventory_hostname }}"
|
||||
state: directory
|
||||
owner: "{{ borg_account }}"
|
||||
group: "{{ borg_account }}"
|
||||
group: "backup"
|
||||
delegate_to: "{{ borg_server }}"
|
||||
|
||||
- name: get public key
|
||||
@@ -32,7 +32,7 @@
|
||||
line: 'command="borg serve --restrict-to-path {{ borg_remote_dir }}" {{ public_key }} from {{ inventory_hostname }}'
|
||||
create: true
|
||||
owner: "{{ borg_account }}"
|
||||
group: "{{ borg_account }}"
|
||||
group: "backup"
|
||||
mode: 0600
|
||||
delegate_to: "{{ borg_server }}"
|
||||
|
||||
@@ -49,5 +49,4 @@
|
||||
ansible.builtin.command: "/usr/bin/borg init --encryption=keyfile {{ borg_account }}@{{ borg_server }}:{{ borg_remote_dir }}{{ inventory_hostname }}"
|
||||
environment:
|
||||
BORG_PASSPHRASE: "{{ borg_passphrase }}"
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user