fix: enhance regex for enabling 'snippets' in Proxmox storage configuration
This commit is contained in:
@@ -162,10 +162,15 @@
|
|||||||
- name: "[PREFLIGHT] Ensure 'snippets' is enabled for {{ proxmox_snippets_storage }}"
|
- name: "[PREFLIGHT] Ensure 'snippets' is enabled for {{ proxmox_snippets_storage }}"
|
||||||
ansible.builtin.lineinfile:
|
ansible.builtin.lineinfile:
|
||||||
path: /etc/pve/storage.cfg
|
path: /etc/pve/storage.cfg
|
||||||
insertafter: "^dir: {{ proxmox_snippets_storage }}$"
|
regexp: '^(\s*content\s+.*)(?<!snippets)$'
|
||||||
regexp: '^\s*content\s+.*(?<!snippets)$'
|
line: '\1,snippets'
|
||||||
line: '\g<0>,snippets'
|
|
||||||
backrefs: yes
|
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"
|
- name: "[PREFLIGHT] Ensure snippets storage directory exists"
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
|
|||||||
Reference in New Issue
Block a user