WIP: backups with borg and borgmatic #39
5 changed files with 33 additions and 11 deletions
|
@ -3,7 +3,7 @@
|
|||
roles:
|
||||
- borgbackup_server
|
||||
|
||||
- host: all, !unifi
|
||||
- hosts: all,!unifi
|
||||
roles:
|
||||
- borgbackup_client
|
||||
...
|
||||
|
|
|
@ -103,3 +103,5 @@ borg_backup_directories:
|
|||
- "/etc/"
|
||||
- "/var/"
|
||||
borg_encryption_passphrase: "{{ vault_borg_encryption_passphrase }}"
|
||||
|
||||
borg_server_host: 10.128.0.4
|
||||
|
|
|
@ -1,18 +1,19 @@
|
|||
---
|
||||
- name: Pin borgmatic
|
||||
template:
|
||||
src: "apt/{{ item }}.j2"
|
||||
dest: "/etc/apt/{{ item }}"
|
||||
src: "{{ item.src }}"
|
||||
dest: "{{ item.dest }}"
|
||||
owner: root
|
||||
group: root
|
||||
mode: u=rw,g=r,o=
|
||||
loop:
|
||||
- sources.list.d/bullseye.list
|
||||
- preferences.d/borgmatic-bullseye
|
||||
- src: apt/list.j2
|
||||
dest: /etc/apt/sources.list.d/bullseye.list
|
||||
- src: apt/preferences.j2
|
||||
dest: /etc/apt/preferences.d/borgmatic-bullseye
|
||||
when:
|
||||
- ansible_distribution == "Debian"
|
||||
- ansible_distribution_major_version | int <= 10
|
||||
- ansible_distribution_release != "bullseye"
|
||||
|
||||
- name: Don't pin borgmatic if we are on bullseye
|
||||
file:
|
||||
|
@ -32,10 +33,18 @@
|
|||
retries: 3
|
||||
until: apt_result is succeeded
|
||||
|
||||
- name: Create /etc/borgbackup
|
||||
file:
|
||||
path: /etc/borgbackup
|
||||
state: directory
|
||||
owner: root
|
||||
group: root
|
||||
mode: u=rwx,g=rx,o=
|
||||
|
||||
- name: Create SSH key
|
||||
openssh_keypair:
|
||||
path: /etc/borgbackup/id_remote
|
||||
type: ed25519
|
||||
path: "/etc/borgbackup/id_remote"
|
||||
type: rsa
|
||||
owner: root
|
||||
group: root
|
||||
mode: u=r,g=r,o=
|
||||
|
@ -79,8 +88,6 @@
|
|||
- borgmatic.service
|
||||
notify:
|
||||
- Run systemd daemon-reload
|
||||
- Start and enable borgmatic timer
|
||||
- Start and enable borgmatic service
|
||||
|
||||
- name: Start and enable borgmatic timer
|
||||
systemd:
|
||||
|
@ -94,7 +101,8 @@
|
|||
state: started
|
||||
enabled: true
|
||||
|
||||
- include_role: update_motd
|
||||
- include_role:
|
||||
name: update_motd
|
||||
vars:
|
||||
key: 10-borgmatic
|
||||
message: Borgmatic (client) est installé dans /etc/borgmatic/config.yaml.
|
||||
|
|
3
roles/borgbackup_client/templates/apt/list.j2
Normal file
3
roles/borgbackup_client/templates/apt/list.j2
Normal file
|
@ -0,0 +1,3 @@
|
|||
{{ ansible_managed | comment }}
|
||||
|
||||
deb https://deb.debian.org/debian/ bullseye main
|
9
roles/borgbackup_client/templates/apt/preferences.j2
Normal file
9
roles/borgbackup_client/templates/apt/preferences.j2
Normal file
|
@ -0,0 +1,9 @@
|
|||
{{ ansible_managed | comment }}
|
||||
|
||||
Package: *
|
||||
Pin: release n=bullseye
|
||||
Pin-Priority: 1
|
||||
|
||||
Package: borgmatic
|
||||
Pin: release n=bullseye
|
||||
Pin-Priority: 900
|
Loading…
Reference in a new issue