fix: ensure 'snippets' is enabled for Proxmox storage configuration

This commit is contained in:
2025-12-06 09:12:38 +01:00
parent 567b27264b
commit 701db06dc4

View File

@@ -159,22 +159,14 @@
- name: "[PREFLIGHT] Ensure Proxmox storage supports snippets"
block:
- name: "[PREFLIGHT] Ensure 'snippets' is in the content list for {{ proxmox_snippets_storage }}"
- 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+)(.*)$"
line: '\1{{ (storage_content.split(",") | union(["snippets"])) | join(",") }}'
regexp: '^(\\s*content\\s+)(.*)(?<!snippets)$'
line: '\1\2,snippets'
backrefs: yes
vars:
storage_content: >-
{{ lookup('ansible.builtin.lines', '/etc/pve/storage.cfg')
| select('match', '^\\s*dir: {{ proxmox_snippets_storage }}')
| list
| map('regex_search', '^\\s*content\\s+(.*)$')
| select('string')
| first
| default('') }}
become: true
- name: "[PREFLIGHT] Ensure snippets storage directory exists"
ansible.builtin.file: