diff options
| author | Jan Tuomi <jan@jantuomi.fi> | 2026-05-28 18:20:28 +0300 |
|---|---|---|
| committer | Jan Tuomi <jan@jantuomi.fi> | 2026-05-28 18:21:44 +0300 |
| commit | 224ef25da57b0957f190ca2e2e3bd0045792cdb8 (patch) | |
| tree | fd139e250968bc8b88bc7e3052d93fac378ea374 | |
| parent | da2d3f0fe3eedc6a8949d8b041fedaa8d28e492c (diff) | |
Update backup logic
| -rw-r--r-- | roles/host/tasks/main.yml | 1 | ||||
| -rw-r--r-- | roles/host/templates/etc_crontab.j2 | 4 | ||||
| -rw-r--r-- | roles/host_prod/tasks/main.yml | 4 | ||||
| -rw-r--r-- | roles/host_prod/templates/root_ssh_config.j2 | 5 | ||||
| -rw-r--r-- | roles/host_prod/templates/usr_local_bin_backup.sh.j2 | 8 |
5 files changed, 12 insertions, 10 deletions
diff --git a/roles/host/tasks/main.yml b/roles/host/tasks/main.yml index 01cffb7..aec0054 100644 --- a/roles/host/tasks/main.yml +++ b/roles/host/tasks/main.yml @@ -33,6 +33,7 @@ - py311-wheel - fastfetch - vim + - age loop_control: loop_var: pkg_name diff --git a/roles/host/templates/etc_crontab.j2 b/roles/host/templates/etc_crontab.j2 index 5cd0d86..33276ab 100644 --- a/roles/host/templates/etc_crontab.j2 +++ b/roles/host/templates/etc_crontab.j2 @@ -23,8 +23,8 @@ PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin # Take snapshots every day at 3:05 AM 5 3 * * * root /usr/local/bin/backup snapshot prune-local >>/var/log/backup 2>&1 -# Send backup snapshots to remote every third day at 4:05 AM -5 4 */3 * * root /usr/local/bin/backup send-to-remote prune-remote notify >>/var/log/backup 2>&1 +# Send backup snapshots to remote every Monday at 4:05 AM +5 4 * * 1 root /usr/local/bin/backup send-to-remote prune-remote notify >>/var/log/backup 2>&1 # Run pylogsentinel */10 * * * * root python -m pylogsentinel diff --git a/roles/host_prod/tasks/main.yml b/roles/host_prod/tasks/main.yml index ec635ce..8bf0027 100644 --- a/roles/host_prod/tasks/main.yml +++ b/roles/host_prod/tasks/main.yml @@ -47,7 +47,7 @@ - name: Copy backup SSH private key copy: - src: "{{ backup_ssh_privkey_file }}" + content: "{{ backup.ssh_key.private }}" dest: /root/.ssh/backup owner: root group: wheel @@ -55,7 +55,7 @@ - name: Copy backup SSH public key copy: - src: "{{ backup_ssh_pubkey_file }}" + src: "{{ backup.ssh_key.public }}" dest: /root/.ssh/backup.pub owner: root group: wheel diff --git a/roles/host_prod/templates/root_ssh_config.j2 b/roles/host_prod/templates/root_ssh_config.j2 index 96f78f2..eac9654 100644 --- a/roles/host_prod/templates/root_ssh_config.j2 +++ b/roles/host_prod/templates/root_ssh_config.j2 @@ -1,4 +1,5 @@ Host backup - HostName {{ backup_ssh_host }} - User {{ backup_ssh_user }} + HostName {{ backup.ssh_host }} + User {{ backup.ssh_user }} IdentityFile /root/.ssh/backup + Port {{ backup.ssh_port }} diff --git a/roles/host_prod/templates/usr_local_bin_backup.sh.j2 b/roles/host_prod/templates/usr_local_bin_backup.sh.j2 index f6a0e2c..d610774 100644 --- a/roles/host_prod/templates/usr_local_bin_backup.sh.j2 +++ b/roles/host_prod/templates/usr_local_bin_backup.sh.j2 @@ -3,13 +3,13 @@ set -euo pipefail # ===== CONFIG (filled by Ansible) ===== KEEP_LOCAL=30 -KEEP_REMOTE=10 +KEEP_REMOTE=4 KEYFILE="/root/.ssh/backup" HOST_DIR="backup" -DATASET="{% endraw %}{{ backup_zfs_dataset }}{% raw %}" +DATASET="{% endraw %}{{ backup.zfs_dataset }}{% raw %}" BACKUP_EXCLUDE_PROP="{% endraw %}{{ backup_zfs_exclude_property | default('com.pursotin:backup') }}{% raw %}" -USER="{% endraw %}{{ backup_ssh_user }}{% raw %}" -HOST="{% endraw %}{{ backup_ssh_host }}{% raw %}" +USER="{% endraw %}{{ backup.ssh_user }}{% raw %}" +HOST="{% endraw %}{{ backup.ssh_host }}{% raw %}" EMAIL_TO=root # ===================================== |
