Compare commits

...

2 Commits

Author SHA1 Message Date
5fbc4e9928 add proxmox_delegate_host variable and update check-exists documentation
- Document proxmox_delegate_host for delegating pct commands to inventory host
- Update check-exists.yml description to reflect vmid or hostname checking
- Document lxc_exists fact set by idempotency check
2026-04-15 19:24:05 -04:00
ce7ec1b25f fix: correct file extension from .yaml to .yml 2026-04-15 19:23:43 -04:00
3 changed files with 7 additions and 3 deletions

View File

@@ -13,7 +13,7 @@ It also includes tasks which may be used individually:
- `stop.yml`: Stops an LXC container
- `update.yml`: Updates an existing LXC container
- `wait.yml`: Waits for SSH to be available on the container
- `check-exists.yml`: Checks the existence of the LXC with the given hostname
- `check-exists.yml`: Checks if an LXC exists by `lxc_vmid` or `lxc_hostname`
## Requirements
@@ -41,6 +41,7 @@ It also includes tasks which may be used individually:
|----------|-------------|---------|
| `proxmox_api_port` | The port on which the Proxmox API is listening | `8006` |
| `proxmox_api_validate_certs` | Whether to validate SSL certificates | `false` |
| `proxmox_delegate_host` | Inventory hostname for delegated tasks (pct commands). Use this to inherit `ansible_become_password` from inventory. | `{{ proxmox_api_host }}` |
### Required Container Variables
@@ -88,6 +89,7 @@ proxmox_api_token_id: "mytoken"
proxmox_api_token_secret: "{{ vault_proxmox_token }}"
proxmox_api_validate_certs: false
proxmox_node: "pve01"
proxmox_delegate_host: "proxmox_server" # inventory hostname for become_password
```
### Creating a new LXC from template
@@ -122,7 +124,7 @@ proxmox_node: "pve01"
### Idempotent Behavior
The role includes idempotency checking. If a container with the specified `lxc_vmid` already exists, the role will skip provisioning and exit gracefully.
The role includes idempotency checking. If a container with the specified `lxc_vmid` or `lxc_hostname` already exists, the role will skip provisioning and exit gracefully. Sets `lxc_exists` fact for use in subsequent tasks.
### Using Standalone Tasks

View File

@@ -2,6 +2,8 @@
# 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 }}"
# LXC defaults
lxc_template: "local:vztmpl/debian-12-standard_12.12-1_amd64.tar.zst"

View File

@@ -1,7 +1,7 @@
---
- name: Use appropriate tasks for given distribution
ansible.builtin.set_fact:
task_distro_file: "{{ ansible_os_family | lower }}.yaml"
task_distro_file: "{{ ansible_os_family | lower }}.yml"
- name: Verify that the distribution is supported
become: false