mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2024-11-09 22:41:03 +01:00
renamed to backup-remote-to-local
This commit is contained in:
parent
c70f0b2580
commit
db112f3efa
@ -35,7 +35,7 @@ This software shipts the following tools which are natively setup on the server:
|
|||||||
- [Docker Health Check](./roles/health-docker/) - Checks the health of docker containers
|
- [Docker Health Check](./roles/health-docker/) - Checks the health of docker containers
|
||||||
- [Docker Reverse Proxy](./roles/docker-reverse-proxy/README.md) - Docker Reverse Proxy Solution
|
- [Docker Reverse Proxy](./roles/docker-reverse-proxy/README.md) - Docker Reverse Proxy Solution
|
||||||
- [Docker Volume Backup](./roles/backup-docker-to-local/) - Backup Solution for Docker Volumes
|
- [Docker Volume Backup](./roles/backup-docker-to-local/) - Backup Solution for Docker Volumes
|
||||||
- [Pull Primary Backups](./roles/backups-consumer/README.md) - Pulls the backups from another server and stores them
|
- [Pull Primary Backups](./roles/backup-remote-to-local/README.md) - Pulls the backups from another server and stores them
|
||||||
- [Wireguard](./roles/wireguard/README.md) - Integrates the server in an wireguard vpn
|
- [Wireguard](./roles/wireguard/README.md) - Integrates the server in an wireguard vpn
|
||||||
|
|
||||||
### Server Administration
|
### Server Administration
|
||||||
|
@ -204,7 +204,7 @@
|
|||||||
hosts: replica_backup
|
hosts: replica_backup
|
||||||
become: true
|
become: true
|
||||||
roles:
|
roles:
|
||||||
- role: backups-consumer
|
- role: backup-remote-to-local
|
||||||
|
|
||||||
## PC services
|
## PC services
|
||||||
- name: general host setup
|
- name: general host setup
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# role backups-consumer
|
# role backup-remote-to-local
|
||||||
|
|
||||||
## goal
|
## goal
|
||||||
This script allows to pull backups from a remote server.
|
This script allows to pull backups from a remote server.
|
||||||
@ -15,17 +15,17 @@ To track what the service is doing execute one of the following commands:
|
|||||||
|
|
||||||
#### systemctl
|
#### systemctl
|
||||||
```bash
|
```bash
|
||||||
watch -n2 "systemctl status pull-remote-backups.service"
|
watch -n2 "systemctl status backup-remote-to-local.service"
|
||||||
```
|
```
|
||||||
|
|
||||||
#### journalctl
|
#### journalctl
|
||||||
```bash
|
```bash
|
||||||
journalctl -fu pull-remote-backups.service
|
journalctl -fu backup-remote-to-local.service
|
||||||
```
|
```
|
||||||
|
|
||||||
### history
|
### history
|
||||||
```bash
|
```bash
|
||||||
sudo journalctl -u pull-remote-backups
|
sudo journalctl -u backup-remote-to-local
|
||||||
```
|
```
|
||||||
|
|
||||||
## see
|
## see
|
11
roles/backup-remote-to-local/handlers/main.yml
Normal file
11
roles/backup-remote-to-local/handlers/main.yml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
- name: "reload backup-remote-to-local service"
|
||||||
|
systemd:
|
||||||
|
name: backup-remote-to-local.service
|
||||||
|
enabled: yes
|
||||||
|
daemon_reload: yes
|
||||||
|
- name: "restart backup-remote-to-local timer"
|
||||||
|
systemd:
|
||||||
|
name: backup-remote-to-local.timer
|
||||||
|
state: started
|
||||||
|
enabled: yes
|
||||||
|
daemon_reload: yes
|
26
roles/backup-remote-to-local/tasks/main.yml
Normal file
26
roles/backup-remote-to-local/tasks/main.yml
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
- name: "create {{docker_pull_primary_backups_folder}}"
|
||||||
|
file:
|
||||||
|
path: "{{docker_pull_primary_backups_folder}}"
|
||||||
|
state: directory
|
||||||
|
mode: 0755
|
||||||
|
|
||||||
|
- name: create backup-remote-to-local.sh
|
||||||
|
copy:
|
||||||
|
src: backup-remote-to-local.sh
|
||||||
|
dest: "{{docker_pull_primary_backups_folder}}backup-remote-to-local.sh"
|
||||||
|
mode: 0755
|
||||||
|
|
||||||
|
- name: create backup-remote-to-local.service
|
||||||
|
template: src=backup-remote-to-local.service.j2 dest=/etc/systemd/system/backup-remote-to-local.service
|
||||||
|
notify: reload backup-remote-to-local service
|
||||||
|
|
||||||
|
- name: create backup-remote-to-local.timer
|
||||||
|
template: src=backup-remote-to-local.timer.j2 dest=/etc/systemd/system/backup-remote-to-local.timer
|
||||||
|
notify: restart backup-remote-to-local timer
|
||||||
|
|
||||||
|
- name: create backup-remote-to-local.sh
|
||||||
|
template:
|
||||||
|
src: backup-remote-to-local.sh.j2
|
||||||
|
dest: "{{docker_pull_primary_backups_folder}}backup-remote-to-local.sh"
|
||||||
|
mode: 0755
|
||||||
|
|
@ -4,4 +4,4 @@ OnFailure=systemd-notifier@%n.service cleanup-failed-docker-backups.service
|
|||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
ExecStart=/usr/bin/bash {{docker_pull_primary_backups_folder}}pull-remote-backups.sh
|
ExecStart=/usr/bin/bash {{docker_pull_primary_backups_folder}}backup-remote-to-local.sh
|
@ -3,6 +3,6 @@
|
|||||||
hosts="{{pull_remote_backups}}";
|
hosts="{{pull_remote_backups}}";
|
||||||
errors=0
|
errors=0
|
||||||
for host in $hosts; do
|
for host in $hosts; do
|
||||||
bash {{docker_pull_primary_backups_folder}}pull-remote-backup.sh $host || ((errors+=1));
|
bash {{docker_pull_primary_backups_folder}}backup-remote-to-local.sh $host || ((errors+=1));
|
||||||
done;
|
done;
|
||||||
exit $errors;
|
exit $errors;
|
@ -1,11 +0,0 @@
|
|||||||
- name: "reload pull-remote-backups service"
|
|
||||||
systemd:
|
|
||||||
name: pull-remote-backups.service
|
|
||||||
enabled: yes
|
|
||||||
daemon_reload: yes
|
|
||||||
- name: "restart pull-remote-backups timer"
|
|
||||||
systemd:
|
|
||||||
name: pull-remote-backups.timer
|
|
||||||
state: started
|
|
||||||
enabled: yes
|
|
||||||
daemon_reload: yes
|
|
@ -1,26 +0,0 @@
|
|||||||
- name: "create {{docker_pull_primary_backups_folder}}"
|
|
||||||
file:
|
|
||||||
path: "{{docker_pull_primary_backups_folder}}"
|
|
||||||
state: directory
|
|
||||||
mode: 0755
|
|
||||||
|
|
||||||
- name: create pull-remote-backup.sh
|
|
||||||
copy:
|
|
||||||
src: pull-remote-backup.sh
|
|
||||||
dest: "{{docker_pull_primary_backups_folder}}pull-remote-backup.sh"
|
|
||||||
mode: 0755
|
|
||||||
|
|
||||||
- name: create pull-remote-backups.service
|
|
||||||
template: src=pull-remote-backups.service.j2 dest=/etc/systemd/system/pull-remote-backups.service
|
|
||||||
notify: reload pull-remote-backups service
|
|
||||||
|
|
||||||
- name: create pull-remote-backups.timer
|
|
||||||
template: src=pull-remote-backups.timer.j2 dest=/etc/systemd/system/pull-remote-backups.timer
|
|
||||||
notify: restart pull-remote-backups timer
|
|
||||||
|
|
||||||
- name: create pull-remote-backups.sh
|
|
||||||
template:
|
|
||||||
src: pull-remote-backups.sh.j2
|
|
||||||
dest: "{{docker_pull_primary_backups_folder}}pull-remote-backups.sh"
|
|
||||||
mode: 0755
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user