fix 🐛: Enable snippets in storage.cfg

This commit enables the 'snippets' feature in the Proxmox storage configuration file. It achieves this by adding a snippet line to the storage.cfg, ensuring that Proxmox snippets are available.  Additionally, it creates the necessary 'snippets' directory within the specified storage path.
This commit is contained in:
2025-12-08 10:43:15 +01:00
parent c33a1e730b
commit 19b568c2b8

View File

@@ -10,6 +10,24 @@
state: present
update_cache: yes
- name: "[PREFLIGHT] Ensure 'snippets' is enabled for {{ proxmox_snippets_storage }}"
ansible.builtin.replace:
path: /etc/pve/storage.cfg
regexp: '(dir:\s*{{ proxmox_snippets_storage }}[\s\S]*?content\s+)(.*)(?<!snippets)'
replace: '\1\2,snippets'
vars:
proxmox_snippets_storage: local
- name: "[PREFLIGHT] Ensure snippets storage directory exists"
ansible.builtin.file:
path: "{{ proxmox_snippets_storage_path }}/snippets"
state: directory
mode: "0755"
vars:
proxmox_snippets_storage_path: /var/lib/vz
- name: Deploy templates with proxmox_template_vm
ansible.builtin.include_role:
name: joshrnoll.homelab.proxmox_template_vm