From 2170862d5fb6635c8afa2a2a2d53e90a3e0b7430 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Thu, 16 Nov 2023 17:55:54 +0100 Subject: [PATCH] renamed to backup-remote-to-local --- README.md | 2 +- playbook.yml | 2 +- .../README.md | 8 +++--- .../files/backup-remote-to-local.sh} | 0 .../backup-remote-to-local/handlers/main.yml | 11 ++++++++ .../meta/main.yml | 0 roles/backup-remote-to-local/tasks/main.yml | 26 +++++++++++++++++++ .../backup-remote-to-local.service.j2} | 2 +- .../templates/backup-remote-to-local.sh.j2} | 2 +- .../backup-remote-to-local.timer.j2} | 0 .../vars/main.yml | 0 roles/backups-consumer/handlers/main.yml | 11 -------- roles/backups-consumer/tasks/main.yml | 26 ------------------- 13 files changed, 45 insertions(+), 45 deletions(-) rename roles/{backups-consumer => backup-remote-to-local}/README.md (81%) rename roles/{backups-consumer/files/pull-remote-backup.sh => backup-remote-to-local/files/backup-remote-to-local.sh} (100%) create mode 100644 roles/backup-remote-to-local/handlers/main.yml rename roles/{backups-consumer => backup-remote-to-local}/meta/main.yml (100%) create mode 100644 roles/backup-remote-to-local/tasks/main.yml rename roles/{backups-consumer/templates/pull-remote-backups.service.j2 => backup-remote-to-local/templates/backup-remote-to-local.service.j2} (61%) rename roles/{backups-consumer/templates/pull-remote-backups.sh.j2 => backup-remote-to-local/templates/backup-remote-to-local.sh.j2} (60%) rename roles/{backups-consumer/templates/pull-remote-backups.timer.j2 => backup-remote-to-local/templates/backup-remote-to-local.timer.j2} (100%) rename roles/{backups-consumer => backup-remote-to-local}/vars/main.yml (100%) delete mode 100644 roles/backups-consumer/handlers/main.yml delete mode 100644 roles/backups-consumer/tasks/main.yml diff --git a/README.md b/README.md index ade05458..c5302b5f 100644 --- a/README.md +++ b/README.md @@ -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 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 -- [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 ### Server Administration diff --git a/playbook.yml b/playbook.yml index b8c84da5..cb8c33e0 100644 --- a/playbook.yml +++ b/playbook.yml @@ -204,7 +204,7 @@ hosts: replica_backup become: true roles: - - role: backups-consumer + - role: backup-remote-to-local ## PC services - name: general host setup diff --git a/roles/backups-consumer/README.md b/roles/backup-remote-to-local/README.md similarity index 81% rename from roles/backups-consumer/README.md rename to roles/backup-remote-to-local/README.md index 64a33cfb..22d808c3 100644 --- a/roles/backups-consumer/README.md +++ b/roles/backup-remote-to-local/README.md @@ -1,4 +1,4 @@ -# role backups-consumer +# role backup-remote-to-local ## goal 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 ```bash - watch -n2 "systemctl status pull-remote-backups.service" + watch -n2 "systemctl status backup-remote-to-local.service" ``` #### journalctl ```bash - journalctl -fu pull-remote-backups.service + journalctl -fu backup-remote-to-local.service ``` ### history ```bash - sudo journalctl -u pull-remote-backups + sudo journalctl -u backup-remote-to-local ``` ## see diff --git a/roles/backups-consumer/files/pull-remote-backup.sh b/roles/backup-remote-to-local/files/backup-remote-to-local.sh similarity index 100% rename from roles/backups-consumer/files/pull-remote-backup.sh rename to roles/backup-remote-to-local/files/backup-remote-to-local.sh diff --git a/roles/backup-remote-to-local/handlers/main.yml b/roles/backup-remote-to-local/handlers/main.yml new file mode 100644 index 00000000..7ae52711 --- /dev/null +++ b/roles/backup-remote-to-local/handlers/main.yml @@ -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 diff --git a/roles/backups-consumer/meta/main.yml b/roles/backup-remote-to-local/meta/main.yml similarity index 100% rename from roles/backups-consumer/meta/main.yml rename to roles/backup-remote-to-local/meta/main.yml diff --git a/roles/backup-remote-to-local/tasks/main.yml b/roles/backup-remote-to-local/tasks/main.yml new file mode 100644 index 00000000..da272c11 --- /dev/null +++ b/roles/backup-remote-to-local/tasks/main.yml @@ -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 + diff --git a/roles/backups-consumer/templates/pull-remote-backups.service.j2 b/roles/backup-remote-to-local/templates/backup-remote-to-local.service.j2 similarity index 61% rename from roles/backups-consumer/templates/pull-remote-backups.service.j2 rename to roles/backup-remote-to-local/templates/backup-remote-to-local.service.j2 index f05845b6..b3ce0da6 100644 --- a/roles/backups-consumer/templates/pull-remote-backups.service.j2 +++ b/roles/backup-remote-to-local/templates/backup-remote-to-local.service.j2 @@ -4,4 +4,4 @@ OnFailure=systemd-notifier@%n.service cleanup-failed-docker-backups.service [Service] 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 diff --git a/roles/backups-consumer/templates/pull-remote-backups.sh.j2 b/roles/backup-remote-to-local/templates/backup-remote-to-local.sh.j2 similarity index 60% rename from roles/backups-consumer/templates/pull-remote-backups.sh.j2 rename to roles/backup-remote-to-local/templates/backup-remote-to-local.sh.j2 index 3e775202..3f51fdfc 100644 --- a/roles/backups-consumer/templates/pull-remote-backups.sh.j2 +++ b/roles/backup-remote-to-local/templates/backup-remote-to-local.sh.j2 @@ -3,6 +3,6 @@ hosts="{{pull_remote_backups}}"; errors=0 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; exit $errors; diff --git a/roles/backups-consumer/templates/pull-remote-backups.timer.j2 b/roles/backup-remote-to-local/templates/backup-remote-to-local.timer.j2 similarity index 100% rename from roles/backups-consumer/templates/pull-remote-backups.timer.j2 rename to roles/backup-remote-to-local/templates/backup-remote-to-local.timer.j2 diff --git a/roles/backups-consumer/vars/main.yml b/roles/backup-remote-to-local/vars/main.yml similarity index 100% rename from roles/backups-consumer/vars/main.yml rename to roles/backup-remote-to-local/vars/main.yml diff --git a/roles/backups-consumer/handlers/main.yml b/roles/backups-consumer/handlers/main.yml deleted file mode 100644 index 06ec2607..00000000 --- a/roles/backups-consumer/handlers/main.yml +++ /dev/null @@ -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 diff --git a/roles/backups-consumer/tasks/main.yml b/roles/backups-consumer/tasks/main.yml deleted file mode 100644 index 09d54239..00000000 --- a/roles/backups-consumer/tasks/main.yml +++ /dev/null @@ -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 -