fix(proxmox_lxc_provision): use literal module-name keys in module_defaults

The previous commit (d5cf6f6) used 'module_defaults: "{{ _proxmox_module_defaults }}"'
to template the entire defaults dict. Ansible rejects this because
module_defaults keys must be static action/module/group names at parse
time — only values may be templated.

Expose _proxmox_api_args as a flat dict of API parameters in
defaults/main.yml, and in each task file's module_defaults block use
the literal community.proxmox.proxmox and community.proxmox.proxmox_vm_info
keys with templated values pointing at the var.
This commit is contained in:
2026-06-28 13:46:16 -04:00
parent d5cf6f656e
commit 1e3ab88304
9 changed files with 33 additions and 19 deletions
@@ -1,6 +1,8 @@
---
- name: Check if LXC exists
module_defaults: "{{ _proxmox_module_defaults }}"
module_defaults:
community.proxmox.proxmox: "{{ _proxmox_api_args }}"
community.proxmox.proxmox_vm_info: "{{ _proxmox_api_args }}"
block:
- name: Query Proxmox for existing LXCs
community.proxmox.proxmox_vm_info:
+3 -1
View File
@@ -1,6 +1,8 @@
---
- name: Clone LXC container
module_defaults: "{{ _proxmox_module_defaults }}"
module_defaults:
community.proxmox.proxmox: "{{ _proxmox_api_args }}"
community.proxmox.proxmox_vm_info: "{{ _proxmox_api_args }}"
block:
- name: Create a full clone of the container
community.proxmox.proxmox:
@@ -1,6 +1,8 @@
---
- name: Convert LXC container to template
module_defaults: "{{ _proxmox_module_defaults }}"
module_defaults:
community.proxmox.proxmox: "{{ _proxmox_api_args }}"
community.proxmox.proxmox_vm_info: "{{ _proxmox_api_args }}"
block:
- ansible.builtin.include_tasks: stop.yml
+3 -1
View File
@@ -1,6 +1,8 @@
---
- name: Create LXC container
module_defaults: "{{ _proxmox_module_defaults }}"
module_defaults:
community.proxmox.proxmox: "{{ _proxmox_api_args }}"
community.proxmox.proxmox_vm_info: "{{ _proxmox_api_args }}"
block:
- name: Create an LXC container
community.proxmox.proxmox:
+3 -1
View File
@@ -1,6 +1,8 @@
---
- name: Delete LXC container
module_defaults: "{{ _proxmox_module_defaults }}"
module_defaults:
community.proxmox.proxmox: "{{ _proxmox_api_args }}"
community.proxmox.proxmox_vm_info: "{{ _proxmox_api_args }}"
block:
- ansible.builtin.include_tasks: stop.yml
+3 -1
View File
@@ -1,6 +1,8 @@
---
- name: Start LXC container
module_defaults: "{{ _proxmox_module_defaults }}"
module_defaults:
community.proxmox.proxmox: "{{ _proxmox_api_args }}"
community.proxmox.proxmox_vm_info: "{{ _proxmox_api_args }}"
block:
- name: Start the LXC container
community.proxmox.proxmox:
+3 -1
View File
@@ -1,6 +1,8 @@
---
- name: Stop LXC container
module_defaults: "{{ _proxmox_module_defaults }}"
module_defaults:
community.proxmox.proxmox: "{{ _proxmox_api_args }}"
community.proxmox.proxmox_vm_info: "{{ _proxmox_api_args }}"
block:
- name: Stop container if it is running
community.proxmox.proxmox:
+3 -1
View File
@@ -1,6 +1,8 @@
---
- name: Update LXC container
module_defaults: "{{ _proxmox_module_defaults }}"
module_defaults:
community.proxmox.proxmox: "{{ _proxmox_api_args }}"
community.proxmox.proxmox_vm_info: "{{ _proxmox_api_args }}"
block:
- name: Update an LXC container
community.proxmox.proxmox: