aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorColin Wilk <colin@wilk.cx>2026-06-26 21:42:26 +0000
committerColin Wilk <colin@wilk.cx>2026-06-27 15:43:21 +0200
commitb8d11180605fbf193e76fba04bb63b5ea4908dcf (patch)
treec452e675dd0aeccd22064beb7e5960e7835ea43e
parent6b5877bb547303f7c8c75721ad09d44093a9154e (diff)
downloadansible-role-borgbackup-b8d11180605fbf193e76fba04bb63b5ea4908dcf.tar.gz
ansible-role-borgbackup-b8d11180605fbf193e76fba04bb63b5ea4908dcf.zip
backup_script!: ensure unique blockinfile marker
The blockinfile marker was only keyed by borg_server_host_url, causing backup blocks to overwrite each other when running the role multiple times on the same host with different repositories. This change includes borg_repo_name in the marker, allowing multiple backup blocks to coexist in the base script. Now running the role twice with different borg_repo_name values creates separate blocks instead of overwriting. This ensures idempotent behavior and allows the base script to accumulate all backup targets as documented. Before: marker for "borg-server" (overwrites on second run) After: marker for "borg-server/configs" and "borg-server/home-data"
-rw-r--r--tasks/client_create_scripts_each.yml2
1 files changed, 1 insertions, 1 deletions
diff --git a/tasks/client_create_scripts_each.yml b/tasks/client_create_scripts_each.yml
index 8e01174..b91c385 100644
--- a/tasks/client_create_scripts_each.yml
+++ b/tasks/client_create_scripts_each.yml
@@ -21,7 +21,7 @@
- name: Insert Backup job block into scripts
ansible.builtin.blockinfile:
path: "{{ script_location }}"
- marker: "## {mark} ANSIBLE MANAGED BLOCK for server: {{ borg_server_host_url }}"
+ marker: "## {mark} ANSIBLE MANAGED BLOCK for {{ borg_server_host_url }}/{{ borg_repo_name }}"
block: |
export BORG_PASSPHRASE={{ borg_passphrase | quote }}
borg create -C {{ borg_compression }} \