Pull variables out of arch_backup
Pull out user-modifiable variables from arch_backup. This should make it easier for anyone to modify.
This commit is contained in:
@@ -3,25 +3,25 @@
|
|||||||
- name: Create backup mount directory
|
- name: Create backup mount directory
|
||||||
file:
|
file:
|
||||||
state: directory
|
state: directory
|
||||||
path: '/mnt/backup0'
|
path: "{{ mount.path }}"
|
||||||
become: yes
|
become: yes
|
||||||
tags: backup
|
tags: backup
|
||||||
- name: Ensure backup0 device exists in crypttab
|
- name: Ensure {{ mount.path }} device exists in crypttab
|
||||||
community.general.crypttab:
|
community.general.crypttab:
|
||||||
name: backup0
|
name: "{{ disk.name }}"
|
||||||
backing_device: UUID=1d7ce570-e695-47a0-9dda-5f14b5b20e21
|
backing_device: "UUID={{ disk.uuid }}"
|
||||||
password: /home/ducoterra/.lukskeys/backup0
|
password: "{{ disk.password }}"
|
||||||
opts: luks
|
opts: luks
|
||||||
state: present
|
state: present
|
||||||
become: yes
|
become: yes
|
||||||
no_log: true
|
no_log: true
|
||||||
tags: backup
|
tags: backup
|
||||||
- name: Ensure backup0 mount exists in fstab
|
- name: Ensure {{ disk.name }} mount exists in fstab
|
||||||
ansible.posix.mount:
|
ansible.posix.mount:
|
||||||
path: /mnt/backup0
|
path: "{{ mount.path }}"
|
||||||
src: /dev/mapper/backup0
|
src: /dev/mapper/{{ disk.name }}
|
||||||
fstype: btrfs
|
fstype: btrfs
|
||||||
opts: defaults,noatime,compress=zstd
|
opts: nofail,x-systemd.device-timeout=1,noatime,compress=zstd
|
||||||
state: present
|
state: present
|
||||||
become: yes
|
become: yes
|
||||||
tags: backup
|
tags: backup
|
||||||
@@ -37,23 +37,17 @@
|
|||||||
dest: /usr/local/scripts/btrfs_backup.sh
|
dest: /usr/local/scripts/btrfs_backup.sh
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
mode: '0760'
|
mode: '0770'
|
||||||
become: yes
|
become: yes
|
||||||
tags: backup
|
tags: backup
|
||||||
- name: Ensure hourly backups of /
|
- name: Ensure hourly backups of each item in backups
|
||||||
ansible.builtin.cron:
|
ansible.builtin.cron:
|
||||||
name: "hourly backup of /"
|
name: "hourly backup of {{ item }}"
|
||||||
minute: "0"
|
minute: "0"
|
||||||
job: "export SOURCE_DIR=/; /usr/local/scripts/btrfs_backup.sh"
|
job: "export SOURCE_DIR={{ item }}; /usr/local/scripts/btrfs_backup.sh"
|
||||||
become: yes
|
|
||||||
tags: backup
|
|
||||||
- name: Ensure hourly backups of /home
|
|
||||||
ansible.builtin.cron:
|
|
||||||
name: "hourly backup of /home"
|
|
||||||
minute: "0"
|
|
||||||
job: "export SOURCE_DIR=/home; /usr/local/scripts/btrfs_backup.sh"
|
|
||||||
become: yes
|
become: yes
|
||||||
tags: backup
|
tags: backup
|
||||||
|
loop: "{{ backups }}"
|
||||||
- name: Ensure cronie service started
|
- name: Ensure cronie service started
|
||||||
ansible.builtin.systemd:
|
ansible.builtin.systemd:
|
||||||
name: cronie
|
name: cronie
|
||||||
|
|||||||
@@ -1,2 +1,12 @@
|
|||||||
---
|
---
|
||||||
# vars file for arch_backup
|
mount:
|
||||||
|
path: /mnt/backup0
|
||||||
|
|
||||||
|
disk:
|
||||||
|
name: backup0
|
||||||
|
uuid: 1d7ce570-e695-47a0-9dda-5f14b5b20e21
|
||||||
|
password: /home/ducoterra/.lukskeys/backup0
|
||||||
|
|
||||||
|
backups:
|
||||||
|
- /
|
||||||
|
- /home
|
||||||
|
|||||||
Reference in New Issue
Block a user