From 739ffb28451b874466e759bfcfdbd880d282e5be Mon Sep 17 00:00:00 2001 From: "Dustin C. Hatch" Date: Fri, 17 Dec 2021 20:57:38 -0600 Subject: [PATCH] home-assistant: Configure BURP backups Take a snapshot of the history database first, then back up everything in `/var/lib/homeassistant`. --- group_vars/home-assistant.yml | 6 ++++++ hosts | 1 + .../files/scripts/hass2.pyrocufflink.blue/backup-pre.sh | 4 ++++ 3 files changed, 11 insertions(+) create mode 100644 roles/burp-client/files/scripts/hass2.pyrocufflink.blue/backup-pre.sh diff --git a/group_vars/home-assistant.yml b/group_vars/home-assistant.yml index 3585c7a..0f8bd40 100644 --- a/group_vars/home-assistant.yml +++ b/group_vars/home-assistant.yml @@ -8,6 +8,7 @@ mosquitto_listeners: - port: 1883 address: ::1 mosquitto_password_file: /etc/mosquitto/passwd +mosquitto_acl_file: /etc/mosquitto/acl apache_default_ssl_vhost: false homeassistant_server_name: homeassistant.pyrocufflink.blue homeassistant_update: false @@ -17,3 +18,8 @@ zigbee2mqtt_update: '{{ homeassistant_update|bool }}' collectd_df: FSType: overlay IgnoreSelected: true + +burp_backup: +- include: /var/lib/homeassistant + +burp_backup_script_pre: /etc/burp/backup-pre.sh diff --git a/hosts b/hosts index 149c630..69085cb 100644 --- a/hosts +++ b/hosts @@ -11,6 +11,7 @@ bw0.pyrocufflink.blue bw0.pyrocufflink.blue cloud0.pyrocufflink.blue file0.pyrocufflink.blue +hass2.pyrocufflink.blue [burp-server] burp1.pyrocufflink.blue diff --git a/roles/burp-client/files/scripts/hass2.pyrocufflink.blue/backup-pre.sh b/roles/burp-client/files/scripts/hass2.pyrocufflink.blue/backup-pre.sh new file mode 100644 index 0000000..ac91c77 --- /dev/null +++ b/roles/burp-client/files/scripts/hass2.pyrocufflink.blue/backup-pre.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +sqlite3 /var/lib/homeassistant/home-assistant_v2.db \ + ".backup '/var/lib/homeassistant/home-assistant_v2.db.bak'"