From 5b953c8dba0d7d4be10f93dfa10da975e5be1294 Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Tue, 9 Jul 2019 11:45:03 +0200 Subject: Added borg backup role --- files/borg.fact | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 files/borg.fact (limited to 'files') diff --git a/files/borg.fact b/files/borg.fact new file mode 100644 index 0000000..555143d --- /dev/null +++ b/files/borg.fact @@ -0,0 +1,18 @@ +#!/bin/sh + +echo '{' +if [ -e '/root/.ssh/borg.pub' ]; then + pubkey=`cat /root/.ssh/borg.pub | tr -d "\n"` + echo -ne ' "pubkey": "'$pubkey'"' + pubkey_prefix=",\n" +fi +if [ -e '/srv/borg/repos/' ]; then + echo -ne "${pubkey_prefix:-}"' "repos": {'"\n" + for repo in `ls /srv/borg/repos/`; do + id=`awk '/^id =/ {print $3}' /srv/borg/repos/${repo}/config` + echo -ne ${repo_prefix:-}' "'$repo'": "'$id'"' + repo_prefix=",\n" + done + echo -ne "\n }" +fi +echo -ne "\n}" -- cgit v1.2.3