diff options
author | Julien Dessaux | 2019-07-09 11:45:03 +0200 |
---|---|---|
committer | Julien Dessaux | 2019-07-09 13:23:47 +0200 |
commit | 5b953c8dba0d7d4be10f93dfa10da975e5be1294 (patch) | |
tree | 2614f898ee114b77a1f7d3ef2af28e1724902747 /files | |
download | borg-ansible-role-5b953c8dba0d7d4be10f93dfa10da975e5be1294.tar.gz borg-ansible-role-5b953c8dba0d7d4be10f93dfa10da975e5be1294.tar.bz2 borg-ansible-role-5b953c8dba0d7d4be10f93dfa10da975e5be1294.zip |
Added borg backup role
Diffstat (limited to '')
-rw-r--r-- | files/borg.fact | 18 |
1 files changed, 18 insertions, 0 deletions
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}" |