fix: ensure 'snippets' is enabled for Proxmox storage configuration
This commit is contained in:
@@ -159,22 +159,14 @@
|
|||||||
|
|
||||||
- name: "[PREFLIGHT] Ensure Proxmox storage supports snippets"
|
- name: "[PREFLIGHT] Ensure Proxmox storage supports snippets"
|
||||||
block:
|
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:
|
ansible.builtin.lineinfile:
|
||||||
path: /etc/pve/storage.cfg
|
path: /etc/pve/storage.cfg
|
||||||
insertafter: "^dir: {{ proxmox_snippets_storage }}$"
|
insertafter: "^dir: {{ proxmox_snippets_storage }}$"
|
||||||
regexp: "^(\\s*content\\s+)(.*)$"
|
regexp: '^(\\s*content\\s+)(.*)(?<!snippets)$'
|
||||||
line: '\1{{ (storage_content.split(",") | union(["snippets"])) | join(",") }}'
|
line: '\1\2,snippets'
|
||||||
backrefs: yes
|
backrefs: yes
|
||||||
vars:
|
become: true
|
||||||
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('') }}
|
|
||||||
|
|
||||||
- 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