1
0
Fork 0
This repository has been archived on 2025-03-10. You can view files and clone it, but cannot push or open issues or pull requests.
ansible-role-borg/files/borg.fact

22 lines
824 B
Bash

#!/bin/sh
###############################################################################
# \_o< WARNING : This file is being managed by ansible! >o_/ #
# ~~~~ ~~~~ #
###############################################################################
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}"