Compare commits
2 Commits
441b9fa824
...
5fbc4e9928
| Author | SHA1 | Date | |
|---|---|---|---|
| 5fbc4e9928 | |||
| ce7ec1b25f |
@@ -13,7 +13,7 @@ It also includes tasks which may be used individually:
|
|||||||
- `stop.yml`: Stops an LXC container
|
- `stop.yml`: Stops an LXC container
|
||||||
- `update.yml`: Updates an existing LXC container
|
- `update.yml`: Updates an existing LXC container
|
||||||
- `wait.yml`: Waits for SSH to be available on the 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
|
## 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_port` | The port on which the Proxmox API is listening | `8006` |
|
||||||
| `proxmox_api_validate_certs` | Whether to validate SSL certificates | `false` |
|
| `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
|
### Required Container Variables
|
||||||
|
|
||||||
@@ -88,6 +89,7 @@ proxmox_api_token_id: "mytoken"
|
|||||||
proxmox_api_token_secret: "{{ vault_proxmox_token }}"
|
proxmox_api_token_secret: "{{ vault_proxmox_token }}"
|
||||||
proxmox_api_validate_certs: false
|
proxmox_api_validate_certs: false
|
||||||
proxmox_node: "pve01"
|
proxmox_node: "pve01"
|
||||||
|
proxmox_delegate_host: "proxmox_server" # inventory hostname for become_password
|
||||||
```
|
```
|
||||||
|
|
||||||
### Creating a new LXC from template
|
### Creating a new LXC from template
|
||||||
@@ -122,7 +124,7 @@ proxmox_node: "pve01"
|
|||||||
|
|
||||||
### Idempotent Behavior
|
### 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
|
### Using Standalone Tasks
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
# Proxmox API connection defaults (optional)
|
# Proxmox API connection defaults (optional)
|
||||||
proxmox_api_port: 8006
|
proxmox_api_port: 8006
|
||||||
proxmox_api_validate_certs: false
|
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 defaults
|
||||||
lxc_template: "local:vztmpl/debian-12-standard_12.12-1_amd64.tar.zst"
|
lxc_template: "local:vztmpl/debian-12-standard_12.12-1_amd64.tar.zst"
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
- name: Use appropriate tasks for given distribution
|
- name: Use appropriate tasks for given distribution
|
||||||
ansible.builtin.set_fact:
|
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
|
- name: Verify that the distribution is supported
|
||||||
become: false
|
become: false
|
||||||
|
|||||||
Reference in New Issue
Block a user