WIP: backups with borg and borgmatic #39

Manually merged
jeltz merged 45 commits from backups into master 2024-07-01 01:55:28 +02:00
Showing only changes of commit 2651432582 - Show all commits

View file

@ -48,7 +48,7 @@
regenerate: full_idempotence
owner: root
group: root
mode: u=r,g=r,o=
mode: u=rw,g=,o=
register: ssh_key
- name: Gather server facts
@ -79,16 +79,18 @@
exclusive: false
user: "{{ borg_server_user }}"
key: "{{ ssh_key.public_key }}"
key_options: >-
command="borg serve --restrict-to-path {{ borg_host_dir }},
no-agent-forwarding,
no-port-forwarding,
no-pty,
no-user-rc,
no-X11-forwarding
key_options: command="borg serve --restrict-to-path {{ borg_host_dir }}",no-agent-forwarding,no-port-forwarding,no-pty,no-user-rc,no-X11-forwarding
vars:
borg_host_dir: "/borg/{{ ansible_fqdn }}"
- name: Create configuration direcotory for borgmatic
file:
state: directory
owner: root
group: root
mode: u=rw,g=r,o=
path: /etc/borgmatic
- name: Add borgmatic configuration file
become: true
template:
@ -97,6 +99,11 @@
owner: root
group: root
mode: u=rw,g=r,o=
vars:
borg_host_dir: "/borg/{{ ansible_fqdn }}"
- name: Init repository
command: borgmatic init --encryption repokey
- name: Install timer and service for borgmatic
template:
@ -111,6 +118,10 @@
notify:
- Run systemd daemon-reload
- name: Run systemd deamon-reload
systemd:
daemon_reload: true
- name: Start and enable borgmatic timer
systemd:
name: borgmatic.timer