fix: enhance regex for enabling 'snippets' in Proxmox storage configuration

This commit is contained in:
2025-12-06 09:25:17 +01:00
parent a403f04500
commit 8082728c6e

View File

@@ -162,10 +162,15 @@
- name: "[PREFLIGHT] Ensure 'snippets' is enabled for {{ proxmox_snippets_storage }}"
ansible.builtin.lineinfile:
path: /etc/pve/storage.cfg
insertafter: "^dir: {{ proxmox_snippets_storage }}$"
regexp: '^\s*content\s+.*(?<!snippets)$'
line: '\g<0>,snippets'
regexp: '^(\s*content\s+.*)(?<!snippets)$'
line: '\1,snippets'
backrefs: yes
# Only apply inside the block for the specified storage
# by matching the storage ID and content line together
# e.g. "dir: local" followed by " content ..."
# This ensures we don't touch other storages
# Use 'search_string' to anchor the block
search_string: "dir: {{ proxmox_snippets_storage }}"
- name: "[PREFLIGHT] Ensure snippets storage directory exists"
ansible.builtin.file: