[borg] lets filter-out shit and backup cameron
parent
59bc91dc9d
commit
6e6dd56e4d
|
@ -0,0 +1,17 @@
|
||||||
|
---
|
||||||
|
glob_borg:
|
||||||
|
to_backup:
|
||||||
|
- /etc
|
||||||
|
- /var
|
||||||
|
path: /backup/borg
|
||||||
|
remote:
|
||||||
|
- borg@zephir.adm.crans.org:/backup/borg/{{ ansible_hostname }}
|
||||||
|
retention:
|
||||||
|
- ["daily", 4]
|
||||||
|
- ["monthly", 6]
|
||||||
|
consistency_check:
|
||||||
|
- disabled
|
||||||
|
extra_init:
|
||||||
|
- make-parent-dirs
|
||||||
|
encryption_passphrase: "{{ vault.borgbackup_passwd }}"
|
||||||
|
ssh_privkey: "{{ vault.borgbackup_ssh_privkey }}"
|
|
@ -9,18 +9,3 @@ debian_mirror: http://mirror.adm.crans.org/debian
|
||||||
ubuntu_mirror: http://mirror.adm.crans.org/ubuntu
|
ubuntu_mirror: http://mirror.adm.crans.org/ubuntu
|
||||||
debian_components: main contrib non-free
|
debian_components: main contrib non-free
|
||||||
ubuntu_components: main restricted universe multiverse
|
ubuntu_components: main restricted universe multiverse
|
||||||
|
|
||||||
glob_borg:
|
|
||||||
to_backup:
|
|
||||||
- /etc
|
|
||||||
- /var
|
|
||||||
path: /backup/borg
|
|
||||||
remote:
|
|
||||||
- borg@zephir.adm.crans.org:/backup/borg/{{ ansible_hostname }}
|
|
||||||
retention:
|
|
||||||
- ["daily", 4]
|
|
||||||
- ["monthly", 6]
|
|
||||||
consistency_check:
|
|
||||||
- disabled
|
|
||||||
extra_init:
|
|
||||||
- make-parent-dirs
|
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
---
|
||||||
|
loc_borg:
|
||||||
|
to_exclude:
|
||||||
|
- /var/mail
|
||||||
|
|
||||||
|
loc_borg_data:
|
||||||
|
path_suffix: ".data"
|
||||||
|
to_backup:
|
||||||
|
- /var/mail
|
||||||
|
- /pool/home
|
||||||
|
remote:
|
||||||
|
- borg@omnomnom.adm.crans.org:/backup/borg/{{ ansible_hostname }}
|
|
@ -5,3 +5,7 @@ interfaces:
|
||||||
|
|
||||||
loc_dovecot:
|
loc_dovecot:
|
||||||
cert_path: /etc/letsencrypt/live/crans.org
|
cert_path: /etc/letsencrypt/live/crans.org
|
||||||
|
|
||||||
|
loc_borg:
|
||||||
|
to_exclude:
|
||||||
|
- /var/mail
|
||||||
|
|
|
@ -4,3 +4,9 @@ loc_postgresql:
|
||||||
loc_slapd:
|
loc_slapd:
|
||||||
ip: "{{ query('ldap', 'ip', 'tealc', 'adm') | ipv4 | first }}"
|
ip: "{{ query('ldap', 'ip', 'tealc', 'adm') | ipv4 | first }}"
|
||||||
replica: false
|
replica: false
|
||||||
|
|
||||||
|
loc_borg:
|
||||||
|
to_backup:
|
||||||
|
- /etc
|
||||||
|
- /var
|
||||||
|
- /pool/home
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
loc_borg:
|
loc_borg:
|
||||||
to_exclude:
|
to_exclude:
|
||||||
- /var/mail
|
- /var/mail
|
||||||
|
- /var/lib/podman
|
||||||
hooks:
|
hooks:
|
||||||
- type: mysql_databases
|
- type: mysql_databases
|
||||||
params:
|
params:
|
||||||
|
|
4
hosts
4
hosts
|
@ -3,8 +3,12 @@
|
||||||
[adh_server]
|
[adh_server]
|
||||||
zamok.adm.crans.org
|
zamok.adm.crans.org
|
||||||
|
|
||||||
|
[backup_data]
|
||||||
|
cameron.adm.crans.org
|
||||||
|
|
||||||
[backups]
|
[backups]
|
||||||
zephir.adm.crans.org
|
zephir.adm.crans.org
|
||||||
|
omnomnom.adm.crans.org
|
||||||
|
|
||||||
[baie]
|
[baie]
|
||||||
cameron.adm.crans.org
|
cameron.adm.crans.org
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
#!/usr/bin/env ansible-playbook
|
#!/usr/bin/env ansible-playbook
|
||||||
---
|
---
|
||||||
|
- hosts: backups
|
||||||
- import_playbook: borgbackups_client.yml
|
vars:
|
||||||
- import_playbook: borgbackups_server.yml
|
borg: '{{ glob_borg | default({}) | combine(loc_borg | default({})) }}'
|
||||||
|
roles:
|
||||||
|
- borgbackup-server
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
#!/usr/bin/env ansible-playbook
|
#!/usr/bin/env ansible-playbook
|
||||||
---
|
---
|
||||||
|
|
||||||
- hosts: server,!stretch
|
- hosts: server,!stretch
|
||||||
vars:
|
vars:
|
||||||
borg: '{{ glob_borg | default({}) | combine(loc_borg | default({})) }}'
|
borg: '{{ glob_borg | default({}) | combine(loc_borg | default({})) }}'
|
||||||
|
@ -8,8 +7,9 @@
|
||||||
roles:
|
roles:
|
||||||
- borgbackup-client
|
- borgbackup-client
|
||||||
|
|
||||||
- hosts: backups
|
- hosts: backup_data
|
||||||
vars:
|
vars:
|
||||||
borg: '{{ glob_borg | default({}) | combine(loc_borg | default({})) }}'
|
borg: '{{ glob_borg | default({}) | combine(loc_borg_data | default({})) }}'
|
||||||
|
mirror: '{{ glob_mirror | default({}) | combine(loc_mirror | default({})) }}'
|
||||||
roles:
|
roles:
|
||||||
- borgbackup-server
|
- borgbackup-client
|
|
@ -1,15 +0,0 @@
|
||||||
#!/usr/bin/env ansible-playbook
|
|
||||||
---
|
|
||||||
|
|
||||||
- hosts: server
|
|
||||||
vars:
|
|
||||||
borg: '{{ glob_borg | default({}) | combine(loc_borg | default({})) }}'
|
|
||||||
mirror: '{{ glob_mirror | default({}) | combine(loc_mirror | default({})) }}'
|
|
||||||
roles:
|
|
||||||
- borgbackup-client
|
|
||||||
|
|
||||||
- hosts: backups
|
|
||||||
vars:
|
|
||||||
borg: '{{ glob_borg | default({}) | combine(loc_borg | default({})) }}'
|
|
||||||
roles:
|
|
||||||
- borgbackup-server
|
|
|
@ -75,6 +75,6 @@
|
||||||
retries: 3
|
retries: 3
|
||||||
until: apt_result is succeeded
|
until: apt_result is succeeded
|
||||||
|
|
||||||
- import_playbook: borgbackups_client.yml
|
- import_playbook: borgbackup_client.yml
|
||||||
- import_playbook: monitoring.yml
|
- import_playbook: monitoring.yml
|
||||||
- import_playbook: network_interfaces.yml
|
- import_playbook: network_interfaces.yml
|
||||||
|
|
|
@ -39,21 +39,21 @@
|
||||||
- name: Deploy borgmatic config
|
- name: Deploy borgmatic config
|
||||||
template:
|
template:
|
||||||
src: "borgmatic/config.yaml.j2"
|
src: "borgmatic/config.yaml.j2"
|
||||||
dest: "/etc/borgmatic/config.yaml"
|
dest: "/etc/borgmatic/config{{ borg.path_suffix | default('') }}.yaml"
|
||||||
mode: 0600
|
mode: 0600
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
|
|
||||||
- name: Init borg repository
|
- name: Init borg repository
|
||||||
command:
|
command:
|
||||||
cmd: /usr/bin/borgmatic init -e repokey
|
cmd: "/usr/bin/borgmatic init -c /etc/borgmatic/config{{ borg.path_suffix | default('') }}.yaml -e repokey"
|
||||||
register: borg_init
|
register: borg_init
|
||||||
changed_when: '"does not exist" in borg_init.stderr'
|
changed_when: '"does not exist" in borg_init.stderr'
|
||||||
|
|
||||||
- name: Deploy borg cron
|
- name: Deploy borg cron
|
||||||
template:
|
template:
|
||||||
src: "cron.d/borg.j2"
|
src: "cron.d/borg.j2"
|
||||||
dest: "/etc/cron.d/borg"
|
dest: "/etc/cron.d/borg{{ borg.path_suffix | default('') }}"
|
||||||
notify: restart cron
|
notify: restart cron
|
||||||
|
|
||||||
- name: Indicate role in motd
|
- name: Indicate role in motd
|
||||||
|
|
|
@ -27,7 +27,7 @@ location:
|
||||||
borgmatic_source_directory: /tmp/borgmatic
|
borgmatic_source_directory: /tmp/borgmatic
|
||||||
|
|
||||||
storage:
|
storage:
|
||||||
encryption_passphrase: {{ vault.borgbackup_passwd }}
|
encryption_passphrase: {{ borg.encryption_passphrase }}
|
||||||
ssh_command: ssh -i /etc/borgmatic/id_ed25519_borg
|
ssh_command: ssh -i /etc/borgmatic/id_ed25519_borg
|
||||||
borg_base_directory: /etc/borgmatic
|
borg_base_directory: /etc/borgmatic
|
||||||
borg_config_directory: /etc/borgmatic/config/
|
borg_config_directory: /etc/borgmatic/config/
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
{{ vault.borgbackup_ssh_privkey }}
|
{{ borg.ssh_privkey }}
|
||||||
|
|
|
@ -2,4 +2,8 @@
|
||||||
|
|
||||||
PATH=$PATH:/usr/sbin:/usr/bin:/usr/local/bin:/sbin:/bin
|
PATH=$PATH:/usr/sbin:/usr/bin:/usr/local/bin:/sbin:/bin
|
||||||
|
|
||||||
|
{% if borg.path_suffix is defined %}
|
||||||
|
{{ 60 | random(seed=inventory_hostname) }} {{ 24 | random(seed=inventory_hostname) }} * * * root borgmatic -c /etc/borgmatic/config{{ borg.path_suffix }}.yaml --syslog-verbosity 1
|
||||||
|
{% else %}
|
||||||
{{ 60 | random(seed=inventory_hostname) }} {{ 24 | random(seed=inventory_hostname) }} * * * root borgmatic --syslog-verbosity 1
|
{{ 60 | random(seed=inventory_hostname) }} {{ 24 | random(seed=inventory_hostname) }} * * * root borgmatic --syslog-verbosity 1
|
||||||
|
{% endif %}
|
||||||
|
|
Loading…
Reference in New Issue