aboutsummaryrefslogtreecommitdiffstats
path: root/tasks/client_create_scripts_each.yml
diff options
context:
space:
mode:
authorColin Wilk <colin@wilk.cx>2026-09-01 21:01:05 +0200
committerColin Wilk <colin@wilk.cx>2026-09-01 21:43:57 +0200
commit9c7586c7c3a235672ec6490d1a8bc44a222ce5d1 (patch)
tree8b36c5ee3105da2ae769c0d9cd96683d213c949d /tasks/client_create_scripts_each.yml
parentfa137a92e1084a07608a4008ec0cb891baa76774 (diff)
downloadansible-role-borgbackup-9c7586c7c3a235672ec6490d1a8bc44a222ce5d1.tar.gz
ansible-role-borgbackup-9c7586c7c3a235672ec6490d1a8bc44a222ce5d1.zip
Add borg prune and compact jobs
Run repository retention either after a successful backup or from a dedicated systemd timer. Clean up script generation with templates and expand molecule test coverage. BREAKING CHANGE: Aggregate backup scripts are no longer managed, and state=preset now requires at least one readable included directory.
Diffstat (limited to 'tasks/client_create_scripts_each.yml')
-rw-r--r--tasks/client_create_scripts_each.yml34
1 files changed, 0 insertions, 34 deletions
diff --git a/tasks/client_create_scripts_each.yml b/tasks/client_create_scripts_each.yml
deleted file mode 100644
index 6056b81..0000000
--- a/tasks/client_create_scripts_each.yml
+++ /dev/null
@@ -1,34 +0,0 @@
----
-- name: Create script for automatic borg backup
- ansible.builtin.file:
- dest: "{{ script_location }}"
- state: touch
- owner: "{{ borg_client_user }}"
- group: "{{ borg_client_user }}"
- modification_time: preserve
- access_time: preserve
- mode: "0711"
- become: true
-
-- name: Insert shebang into backup script
- ansible.builtin.lineinfile:
- path: "{{ script_location }}"
- line: "#!/bin/bash"
- insertbefore: BOF
- state: present
- become: true
-
-- name: Insert Backup job block into scripts
- ansible.builtin.blockinfile:
- path: "{{ script_location }}"
- marker: "## {mark} ANSIBLE MANAGED BLOCK for {{ borg_server_host_url }}/{{ borg_repo_name }}"
- block: |
- export BORG_PASSPHRASE={{ borg_passphrase | quote }}
- {% if borg_ssh_key_per_repo %}
- export BORG_RSH="ssh -i {{ borg_ssh_key_path }}"
- {% endif %}
- borg create -C {{ borg_compression }}{% if borg_create_additional_arguments %} {{ borg_create_additional_arguments }}{% endif %} \
- {{ borg_server_user }}@{{ borg_server_host_url }}:{{ borg_server_user_home }}/{{ borg_repo_name }}::{{ borg_backup_name_format }} \
- {{ borg_included_dirs | map('quote') | join(' ') }} \
- {% for e in (borg_excluded_dirs | map('quote')) %} --exclude {{ e }} {% endfor %}
- become: true