summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2022-01-13 22:43:31 +0100
committerChristian Pointner <equinox@spreadspace.org>2022-01-13 22:43:31 +0100
commitc12a7f4fb6cb1c2cd6ec415f9558d7455126f51f (patch)
tree20985fb9016a934a30418ce88b7a66a823620e55
parentch-apps: basic install (diff)
enable syncoid-based backups for ch-apps data dir
-rw-r--r--inventory/host_vars/ch-apps.yml4
-rw-r--r--inventory/host_vars/ch-epimetheus.yml12
-rw-r--r--roles/storage/zfs/syncoid/templates/syncoid_finalize.j27
3 files changed, 22 insertions, 1 deletions
diff --git a/inventory/host_vars/ch-apps.yml b/inventory/host_vars/ch-apps.yml
index b04d7978..860ef4f6 100644
--- a/inventory/host_vars/ch-apps.yml
+++ b/inventory/host_vars/ch-apps.yml
@@ -65,6 +65,10 @@ spreadspace_apt_repo_components:
- container
+ssh_keys_root_extra:
+ - ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIZK9NBainiE0+A8pT8dbwlNZ0k0AZVhLTzUSo3YtKJt ZFS Backup syncoid@epimetheus
+
+
zfs_arc_size:
min: 512MB
max: 2GB
diff --git a/inventory/host_vars/ch-epimetheus.yml b/inventory/host_vars/ch-epimetheus.yml
index ee26cc65..8ac909ab 100644
--- a/inventory/host_vars/ch-epimetheus.yml
+++ b/inventory/host_vars/ch-epimetheus.yml
@@ -104,6 +104,18 @@ zfs_syncoid_sources:
nvme/vm:
recursive: yes
skip_parent: yes
+ 'ch-apps':
+ ssh_hostname: "{{ network_zones.svc.prefix | ipaddr(network_zones.svc.offsets['ch-apps']) | ipaddr('address') }}"
+ ssh_port: "{{ hostvars['ch-apps'].ansible_port }}"
+ ## TODO: enable this once ch-apps is part of prometheus
+ # report_prometheus_textfile_path: "/var/lib/prometheus-node-exporter/textfile-collector"
+ periodic:
+ schedule: "*-*-* 00,06,12,18:15:00"
+ timeout: 5h
+ paths:
+ storage:
+ recursive: yes
+ skip_parent: yes
'ch-equinox-t450s':
ssh_hostname: 192.168.28.139
ssh_port: 222
diff --git a/roles/storage/zfs/syncoid/templates/syncoid_finalize.j2 b/roles/storage/zfs/syncoid/templates/syncoid_finalize.j2
index 3869e975..638781ac 100644
--- a/roles/storage/zfs/syncoid/templates/syncoid_finalize.j2
+++ b/roles/storage/zfs/syncoid/templates/syncoid_finalize.j2
@@ -42,6 +42,11 @@ syncoid_pull_run{backup_server="{{ inventory_hostname }}"} $now
syncoid_pull_duration_seconds{backup_server="{{ inventory_hostname }}"} $duration
EOF
+if [ "$#" -eq 0 ]; then
+ echo "not transferring prometheus metrics."
+ exit $ret
+fi
+
if [ -z "$1" ] || [ -z "$2" ] || [ "$1" == "--" ] || [ "$2" == "--" ]; then
echo "$0 <host> <textfile-collector-path> [ -- <additional ssh arguments .. > ]"
@@ -58,7 +63,7 @@ if [ -n "$1" ]; then
shift
fi
-echo "transfering prometheus metrics to: $report_to:$textfile_collector_path"
+echo "transferring prometheus metrics to: $report_to:$textfile_collector_path"
cat "$RUNTIME_DIRECTORY/metrics" | ssh -o "UserKnownHostsFile=/var/lib/syncoid/ssh.knownhosts" -o "HashKnownHosts=no" -i "/var/lib/syncoid/id_ssh_ed25519" "$@" "$report_to" "cat > '$textfile_collector_path/syncoid-pull-{{ inventory_hostname }}.prom'"
exit $ret