add logic to create timers and borgmatic configs
parent
1e2f7a1e8d
commit
34d597ebe2
@ -0,0 +1,6 @@
|
|||||||
|
borgmatic_retention_daily: 7
|
||||||
|
borgmatic_retention_weekly: 4
|
||||||
|
borgmatic_retention_monthly: 6
|
||||||
|
borgmatic_retention_yearly: 1
|
||||||
|
borgmatic_nightly_time: "04:20:00"
|
||||||
|
borgmatic_encryption_passphrase: "tilde.fun"
|
@ -0,0 +1,19 @@
|
|||||||
|
- name: Install Borg Backup via dnf package manager
|
||||||
|
ansible.builtin.apt:
|
||||||
|
name:
|
||||||
|
- "borgbackup"
|
||||||
|
- "borgmatic"
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: Create borgmatic conf folder
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "/etc/borgmatic.d/"
|
||||||
|
state: directory
|
||||||
|
|
||||||
|
- name: Copy systemd unit files
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: "../files/borgmatic@.service"
|
||||||
|
dest: "/etc/systemd/system/borgmatic@.service"
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: u=rw,g=r,o=r
|
@ -0,0 +1,18 @@
|
|||||||
|
- name: Install Borg Backup via dnf package manager
|
||||||
|
ansible.builtin.dnf:
|
||||||
|
name: "borgbackup"
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: Install Borgmatic via Pip package manager
|
||||||
|
ansible.builtin.pip:
|
||||||
|
name: "borgmatic"
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: Copy systemd unit files
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: "../files/borgmatic@.service"
|
||||||
|
dest: "/etc/systemd/system/borgmatic@.service"
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: u=rw,g=r,o=r
|
||||||
|
|
@ -1,18 +1,9 @@
|
|||||||
- name: Install Borg Backup via dnf package manager
|
- name: install borg and borgmatic on Debian
|
||||||
ansible.builtin.dnf:
|
when: ansible_os_family == "Debian"
|
||||||
name: "borgbackup"
|
include_tasks:
|
||||||
state: present
|
file: "install-debian.yml"
|
||||||
|
|
||||||
- name: Install Borgmatic via Pip package manager
|
- name: install borg and borgmatic on Fedora
|
||||||
ansible.builtin.pip:
|
when: ansible_os_family == "Fedora"
|
||||||
name: "borgmatic"
|
include_tasks:
|
||||||
state: present
|
file: "install-fedora.yml"
|
||||||
|
|
||||||
- name: Copy systemd unit files
|
|
||||||
ansible.builtin.copy:
|
|
||||||
src: "../files/borgmatic@.service"
|
|
||||||
dest: "/etc/systemd/system/borgmatic@.service"
|
|
||||||
owner: root
|
|
||||||
group: root
|
|
||||||
mode: u=rw,g=r,o=r
|
|
||||||
|
|
@ -0,0 +1,10 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=%j backups for %i
|
||||||
|
|
||||||
|
[Timer]
|
||||||
|
Unit=borgmatic@%i.service
|
||||||
|
OnCalendar=*-*-* {{ borgmatic_nightly_time }}
|
||||||
|
RandomizedDelaySec=15min
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=timers.target
|
@ -0,0 +1,16 @@
|
|||||||
|
location:
|
||||||
|
source_directories:
|
||||||
|
{% for directory in borgmatic_source_directories %}
|
||||||
|
- {{ directory }}
|
||||||
|
{% endfor %}
|
||||||
|
repositories:
|
||||||
|
{% for repository in borgmatic_repositories %}
|
||||||
|
- {{ repository }}
|
||||||
|
{% endfor %}
|
||||||
|
retention:
|
||||||
|
keep_daily: {{ borgmatic_retention_daily }}
|
||||||
|
keep_weekly: {{ borgmatic_retention_weekly }}
|
||||||
|
keep_monthly: {{ borgmatic_retention_monthly }}
|
||||||
|
keep_yearly: {{ borgmatic_retention_yearly }}
|
||||||
|
storage:
|
||||||
|
encryption_passphrase: {{ borgmatic_encryption_passphrase }}
|
Loading…
Reference in New Issue