From 920d94d69c6140da7fa4678d8f4f1ac3598c1b48 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Wed, 12 Apr 2023 10:36:38 +0200 Subject: [PATCH] Optimized backup scripts --- .../files/backups-cleanup.timer | 3 ++- roles/native-pull-primary-backups/tasks/main.yml | 12 +++++++++--- roles/native-pull-primary-backups/vars/main.yml | 2 +- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/roles/native-backups-cleanup/files/backups-cleanup.timer b/roles/native-backups-cleanup/files/backups-cleanup.timer index 5265a849..35297ffc 100644 --- a/roles/native-backups-cleanup/files/backups-cleanup.timer +++ b/roles/native-backups-cleanup/files/backups-cleanup.timer @@ -2,7 +2,8 @@ Description=starts backups-cleanup.service [Timer] -OnCalendar=19:00 +OnBootSec=1min +OnUnitActiveSec=12h RandomizedDelaySec=1h [Install] diff --git a/roles/native-pull-primary-backups/tasks/main.yml b/roles/native-pull-primary-backups/tasks/main.yml index cba08327..878d2118 100644 --- a/roles/native-pull-primary-backups/tasks/main.yml +++ b/roles/native-pull-primary-backups/tasks/main.yml @@ -1,15 +1,21 @@ +- 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: "bash {{docker_pull_primary_backups_folder}}pull-remote-backup.sh" + dest: "{{docker_pull_primary_backups_folder}}pull-remote-backup.sh" - name: create pull-remote-backups.service template: src=pull-remote-backups.service.j2 dest=/etc/systemd/system/pull-remote-backups.service - notify: restart pull-remote-backups serviceß + notify: restart 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=bash {{docker_pull_primary_backups_folder}}pull-remote-backups.sh + template: src=pull-remote-backups.sh.j2 dest={{docker_pull_primary_backups_folder}}pull-remote-backups.sh diff --git a/roles/native-pull-primary-backups/vars/main.yml b/roles/native-pull-primary-backups/vars/main.yml index d72095d6..a0370f58 100644 --- a/roles/native-pull-primary-backups/vars/main.yml +++ b/roles/native-pull-primary-backups/vars/main.yml @@ -1 +1 @@ -docker_pull_primary_backups_folder: "/usr/local/bin/pull-primary-backups/" \ No newline at end of file +docker_pull_primary_backups_folder: "/home/administrator/scripts/pull-primary-backups/" \ No newline at end of file