d5cf6f656e9b8c1400df7d170215d2e13242416a
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.
Infrastructure Collection
Ansible collection for infrastructure management, system configuration, and virtualization.
Roles
proxmox_lxc_provision
Manages Proxmox LXC containers with comprehensive lifecycle operations.
- Create, clone, start, stop, and delete containers
- Template conversion and configuration editing
- Post-provisioning tasks and health checks
system_setup
Performs initial system configuration for new servers.
- Creates admin user with SSH key authentication
- Hardens SSH configuration
- Installs essential packages
- Optional passwordless sudo configurations
system_maintenance
Updates packages and handles maintenance across multiple distributions.
- Multi-distribution support (Debian/Ubuntu/Alpine)
- Package updates and cleanup
- Automatic reboot handling when required
nvidia_drivers
Installs NVIDIA drivers and CUDA runtime with proper idempotency and error handling.
- Supports Debian/Ubuntu with automatic OS detection
- Choice between proprietary and open-source drivers
- Post-installation verification and cleanup
- Architecture detection (x86_64/arm64)
Installation
ansible-galaxy collection install patrickj.infrastructure
Quick Start
Proxmox API Configuration
Set up your Proxmox API connection variables in group vars:
# 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
- name: Create and start an LXC container
hosts: localhost
connection: local
vars:
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
- name: Configure the LXC container
hosts: new-debian-container
become: yes
tasks:
- include_role:
name: patrickj.infrastructure.system_setup
vars:
password: "{{ admin_password }}"
ssh_pubkey_file: "~/.ssh/id_rsa.pub"
- include_role:
name: patrickj.infrastructure.nvidia_drivers
vars:
nvidia_install_kernel_modules: true
when: gpu_server | default(false)
Requirements
- Ansible >= 2.12
- Root/sudo privileges on target hosts
- community.general collection
- community.proxmox collection
- ansible.posix collection
License
MIT
Author
Patrick Jaroszewski
Description
Languages
Jinja
100%