Implemented role native-pull-remote-backups

This commit is contained in:
Kevin Veen-Birkenbach 2020-12-26 15:20:23 +01:00
parent c6bf70cebb
commit fa21feac87
7 changed files with 40 additions and 2 deletions

View File

@ -0,0 +1,4 @@
- name: restart pull-remote-backups service
service: name=pull-remote-backups.service state=restarted enabled=yes
- name: restart pull-remote-backups timer
service: name=pull-remote-backups.timer state=restarted enabled=yes

View File

@ -0,0 +1,2 @@
dependencies:
- native-git

View File

@ -0,0 +1,13 @@
- name: pull-remote-backups git
git:
repo: "https://github.com/kevinveenbirkenbach/pull-remote-backup.git"
dest: "/usr/local/bin/pull-remote-backup"
update: yes
- name: configure pull-remote-backups.service.tpl
template: src=pull-remote-backups.service dest=/etc/systemd/system/pull-remote-backups.service
notify: restart pull-remote-backups service
- name: configure pull-remote-backups.timer.tpl
template: src=pull-remote-backups.timer dest=/etc/systemd/system/pull-remote-backups.timer
notify: restart pull-remote-backups timer

View File

@ -0,0 +1,6 @@
[Unit]
Description=docker volume update
[Service]
Type=oneshot
ExecStart=hosts="{{pull_remote_backups_hosts}}";for host in $hosts; do /usr/bin/bash /usr/local/bin/pull-remote-backup/pull-remote-backup.sh $host; done;

View File

@ -0,0 +1,9 @@
[Unit]
Description=pulls a remote backup
[Timer]
OnCalendar=22:00
RandomizedDelaySec=1h
[Install]
WantedBy=timers.target

View File

@ -1,3 +1,4 @@
# Role Administrator
This role creates an standard administrator user.
For security reasons it's recommended to use this user instead of the standard root user.
Please consider the concerns in this article https://unix.stackexchange.com/questions/92123/rsync-all-files-of-remote-machine-over-ssh-without-root-user.

View File

@ -6,7 +6,10 @@
- native-pacman
- native-wireguard
- native-user-alarm
- native-user-administrator
- name: setup stores of backups
hosts: backup_stores
roles:
- native-pull-remote-backups
- name: setup webservers
hosts: webservers
roles: