d5cf6f656e
Previously the community.proxmox.proxmox / proxmox_vm_info module_defaults were defined inline on the outer block in main.yml. Invoking individual task files via 'tasks_from: stop' (or delete/convert/etc.) bypassed main.yml, leaving the API parameters unset and producing 'missing required arguments: api_host, api_user' errors. The README worked around this by telling callers to repeat the module_defaults block at the play level — easy to forget, and duplicated config. Extract the defaults dict into _proxmox_module_defaults in defaults/main.yml (using a YAML anchor to share between the two modules), and wrap every task file that calls a Proxmox module in a block that references it. Callers only need the proxmox_* connection vars in scope (typically group_vars/all/) — both 'roles:' and 'tasks_from:' invocations now configure the API consistently. Files wrapped: check-exists, create, clone, update, start, stop, delete, convert. wait/post-clone/edit-config don't call Proxmox modules and are unchanged. main.yml's now-redundant outer module_defaults is removed. README updated to drop the 'Using Standalone Tasks' workaround boilerplate.
45 lines
1.4 KiB
YAML
Executable File
45 lines
1.4 KiB
YAML
Executable File
---
|
|
# Proxmox API connection defaults (optional)
|
|
proxmox_api_port: 8006
|
|
proxmox_api_validate_certs: false
|
|
# Host to delegate pct commands to (use inventory hostname for become_password to work)
|
|
proxmox_delegate_host: "{{ proxmox_api_host }}"
|
|
|
|
# Shared module_defaults applied by every task file that calls the Proxmox API.
|
|
# Override the underlying proxmox_* vars (e.g. from group_vars/all/) to customize.
|
|
_proxmox_module_defaults:
|
|
community.proxmox.proxmox: &_proxmox_api_args
|
|
api_host: "{{ proxmox_api_host }}"
|
|
api_port: "{{ proxmox_api_port }}"
|
|
api_user: "{{ proxmox_api_user }}"
|
|
api_token_id: "{{ proxmox_api_token_id }}"
|
|
api_token_secret: "{{ proxmox_api_token_secret }}"
|
|
validate_certs: "{{ proxmox_api_validate_certs }}"
|
|
node: "{{ proxmox_node }}"
|
|
community.proxmox.proxmox_vm_info: *_proxmox_api_args
|
|
|
|
# LXC defaults
|
|
lxc_template: "local:vztmpl/debian-12-standard_12.12-1_amd64.tar.zst"
|
|
lxc_cores: 4
|
|
lxc_memory: 2048
|
|
lxc_swap: 2048
|
|
lxc_storage: local-zfs
|
|
lxc_size: 16
|
|
lxc_disk: "{{ lxc_storage }}:{{ lxc_size }}"
|
|
lxc_ipv4: dhcp
|
|
lxc_ipv6: auto
|
|
lxc_nameserver: 10.0.0.7
|
|
lxc_gateway: 10.0.0.1
|
|
lxc_bridge: vmbr0
|
|
lxc_iface_name: eth0
|
|
# lxc_vlan_tag: unset by default; set to an integer (1-4094) to add an 802.1Q tag
|
|
lxc_pubkey_file: "~/.ssh/id_ed25519.pub"
|
|
lxc_unprivileged: true
|
|
lxc_features:
|
|
- nesting=1
|
|
lxc_nvidia_gpu_mount: false
|
|
lxc_tags: ["ansible-managed"]
|
|
lxc_clone_type: full
|
|
lxc_start: true
|
|
lxc_user_name: admin
|