changed to jerick user for docker, dynamic storage assignation

This commit is contained in:
2026-02-03 11:49:24 -05:00
parent ccb3ce0e71
commit 09e31a025b
3 changed files with 38 additions and 4 deletions

View File

@@ -1,4 +1,21 @@
---
- name: Get available storage on template node
ansible.builtin.uri:
url: "https://{{ proxmox_api_host }}:8006/api2/json/nodes/{{ lxc_template_node }}/storage"
method: GET
headers:
Authorization: "PVEAPIToken={{ proxmox_api_user }}!{{ proxmox_api_token_id }}={{ proxmox_api_token_secret }}"
validate_certs: false
register: storage_info
- name: Set storage backend (prefer local-zfs if available)
ansible.builtin.set_fact:
clone_storage: "{{ 'local-zfs' if storage_info.json.data | selectattr('storage', 'equalto', 'local-zfs') | list | length > 0 else 'local-lvm' }}"
- name: Display selected storage
ansible.builtin.debug:
msg: "Using storage backend: {{ clone_storage }}"
- name: Clone LXC from template (on template's node)
community.proxmox.proxmox:
api_host: "{{ proxmox_api_host }}"
@@ -9,7 +26,7 @@
clone: "{{ lxc_template_id }}"
hostname: "{{ vm_hostname }}"
full: true
storage: "local-lvm"
storage: "{{ clone_storage }}"
timeout: 600
register: cloned_lxc