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