sftpbackup: Remove wrapper role
This commit is contained in:
parent
4d127f05e7
commit
d050c5c723
4 changed files with 1 additions and 42 deletions
|
@ -28,4 +28,4 @@
|
||||||
- backup_server
|
- backup_server
|
||||||
- backup_bitbucket
|
- backup_bitbucket
|
||||||
- backup_github
|
- backup_github
|
||||||
- sftpbackup
|
- rclone
|
||||||
|
|
|
@ -1,29 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
set -u
|
|
||||||
umas 077
|
|
||||||
|
|
||||||
TARGET="/export/backup"
|
|
||||||
CONFIG="/etc/rclone/rclone.conf"
|
|
||||||
LOGDIR="/var/log/rclone"
|
|
||||||
RCLONE="/usr/local/bin/rclone"
|
|
||||||
|
|
||||||
timestamp="$(date %Y%m%d)"
|
|
||||||
|
|
||||||
if [ ! -d "$TARGET" ]; then
|
|
||||||
echo "ERR: Destination directory '${TARGET}' does not exist" 1>&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
for host in $("$RCLONE" --config "$CONFIG" listremotes | tr -d ":") ; do
|
|
||||||
fqdn="$("$RCLONE" --config "$CONFIG" config show "$host" | \
|
|
||||||
awk '{ if ($1 == "host") print $3 }')"
|
|
||||||
if [ ! -d "${TARGET}/${fqdn}" ]; then
|
|
||||||
mkdir "${TARGET}/${fqdn}"
|
|
||||||
fi
|
|
||||||
log="${LOGDIR}/${fqdn}.${timestamp}.log"
|
|
||||||
if ! "$RCLONE" --config "$CONFIG" --log-file "$log" --log-level INFO \
|
|
||||||
sync "${host}:/" "${TARGET}/${fqdn}/"; then
|
|
||||||
cat "$log"
|
|
||||||
fi
|
|
||||||
done
|
|
|
@ -1,3 +0,0 @@
|
||||||
---
|
|
||||||
dependencies:
|
|
||||||
- {role: ssh_known_hosts}
|
|
|
@ -1,9 +0,0 @@
|
||||||
---
|
|
||||||
- name: Import rclone role
|
|
||||||
ansible.builtin.import_role:
|
|
||||||
name: rclone
|
|
||||||
vars:
|
|
||||||
hostgroup: sftpbackup
|
|
||||||
remote_user: backup
|
|
||||||
destination: /export/backup
|
|
||||||
private_key: /root/.ssh/id_ed25519
|
|
Loading…
Add table
Reference in a new issue