Mount homeassistant data into restic for external backup
This commit is contained in:
parent
47bcbd855e
commit
eed75d8648
4 changed files with 38 additions and 0 deletions
|
@ -1,5 +1,6 @@
|
||||||
restic_backup_locations:
|
restic_backup_locations:
|
||||||
- /mnt/tank
|
- /mnt/tank
|
||||||
|
- /mnt/home-assistant
|
||||||
restic_healthchecks_id: !vault |
|
restic_healthchecks_id: !vault |
|
||||||
$ANSIBLE_VAULT;1.1;AES256
|
$ANSIBLE_VAULT;1.1;AES256
|
||||||
61343535336633643231356138356631663130313234343538366634393661666232303965643365
|
61343535336633643231356138356631663130313234343538366634393661666232303965643365
|
||||||
|
|
29
ansible/roles/restic/tasks/homeassistant.yml
Normal file
29
ansible/roles/restic/tasks/homeassistant.yml
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
- name: Install CIFS utils
|
||||||
|
package:
|
||||||
|
name: cifs-utils
|
||||||
|
become: true
|
||||||
|
|
||||||
|
- name: Create dir for CIFS mount
|
||||||
|
file:
|
||||||
|
path: /mnt/home-assistant
|
||||||
|
state: directory
|
||||||
|
mode: "0755"
|
||||||
|
become: true
|
||||||
|
|
||||||
|
- name: Create dir for each CIFS mount
|
||||||
|
file:
|
||||||
|
path: /mnt/home-assistant/{{ item }}
|
||||||
|
state: directory
|
||||||
|
mode: "0600"
|
||||||
|
become: true
|
||||||
|
loop: "{{ restic_homeassistant_mounts }}"
|
||||||
|
|
||||||
|
- name: Create mounts
|
||||||
|
mount:
|
||||||
|
path: /mnt/home-assistant/{{ item }}
|
||||||
|
fstype: cifs
|
||||||
|
opts: username=homeassistant,password=homeassistant
|
||||||
|
src: //{{ pve_hosts.homeassistant.ip }}/{{ item }}
|
||||||
|
state: mounted
|
||||||
|
become: true
|
||||||
|
loop: "{{ restic_homeassistant_mounts }}"
|
|
@ -90,3 +90,7 @@
|
||||||
mode: "0600"
|
mode: "0600"
|
||||||
become: true
|
become: true
|
||||||
when: ansible_os_family == 'Archlinux'
|
when: ansible_os_family == 'Archlinux'
|
||||||
|
|
||||||
|
- name: Install HomeAssistant mounts
|
||||||
|
include_tasks: homeassistant.yml
|
||||||
|
when: ansible_hostname == 'pve-restic'
|
||||||
|
|
|
@ -25,3 +25,7 @@ restic_key: !vault |
|
||||||
66643135336539333738623231346331623464636637373639666435663961383936
|
66643135336539333738623231346331623464636637373639666435663961383936
|
||||||
restic_b2_bucket: 0rng-restic
|
restic_b2_bucket: 0rng-restic
|
||||||
healthchecks_host: https://hc-ping.com
|
healthchecks_host: https://hc-ping.com
|
||||||
|
|
||||||
|
restic_homeassistant_mounts:
|
||||||
|
- backup
|
||||||
|
- config
|
||||||
|
|
Loading…
Reference in a new issue