refactor: use module_defaults for proxmox API connection

- Replace YAML merge keys (<<:) with module_defaults block in main.yml
- Simplify connection variables to individual vars instead of dictionary
- Remove redundant connection params from individual task files
- Document standalone task usage requires play-level module_defaults
- Update README examples with new variable pattern
This commit is contained in:
2026-04-14 17:18:18 -04:00
parent 570eba84e7
commit 479996612e
12 changed files with 187 additions and 122 deletions

View File

@@ -43,15 +43,32 @@ ansible-galaxy collection install patrickj.infrastructure
## Quick Start
### Proxmox API Configuration
Set up your Proxmox API connection variables in group vars:
```yaml
# group_vars/all.yml
proxmox_api_host: "10.0.1.1"
proxmox_api_port: 8006
proxmox_api_user: "automation@pve"
proxmox_api_token_id: "mytoken"
proxmox_api_token_secret: "{{ vault_proxmox_token }}"
proxmox_api_validate_certs: false
proxmox_node: "pve01"
```
### Basic Proxmox LXC Container Setup
```yaml
- name: Create and start an LXC container
hosts: localhost
connection: local
vars:
- container_hostname: new-debian-container
- os_template: "local:vztmpl/debian-12_amd64.tar.zst"
- container_ipv4: "10.0.0.99"
lxc_vmid: 100
lxc_hostname: new-debian-container
lxc_template: "local:vztmpl/debian-12_amd64.tar.zst"
lxc_ipv4: "10.0.0.99/24"
roles:
- role: proxmox_lxc_provision
@@ -64,7 +81,7 @@ ansible-galaxy collection install patrickj.infrastructure
vars:
password: "{{ admin_password }}"
ssh_pubkey_file: "~/.ssh/id_rsa.pub"
- include_role:
name: patrickj.infrastructure.nvidia_drivers
vars: