Commit Graph

21 Commits

Author SHA1 Message Date
patrick d5cf6f656e refactor(proxmox_lxc_provision): centralize module_defaults so tasks_from works without setup
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.
2026-06-28 13:42:41 -04:00
patrick 8a9903eb4c fix(system_setup): update include_tasks references from .yaml to .yml
The task files were previously renamed to .yml (commits b2379e5, ce7ec1b)
but main.yml's include_tasks directives still referenced the old .yaml
names, causing role execution to fail with 'Could not find or access'
errors for extra-packages.yaml, user.yaml, and ssh.yaml.
2026-06-28 13:19:58 -04:00
patrick 3b6f59a029 fix(proxmox_lxc_provision): post-clone privilege escalation and SSH key regen var name
The user-module tasks in post-clone.yml were running without become, so
modifying /etc/passwd failed with 'usermod: Permission denied' when the
connection user (e.g. admin) was non-root. Add become: true to both
password tasks. Block-level become is avoided because the known_hosts
task in the same file is delegate_to: localhost and should not sudo on
the controller.

Also fix the variable name passed to the system_setup ssh tasks_from:
post-clone.yml was setting 'regenerate_ssh_keys', but ssh.yml gates on
'regenerate_ssh_host_keys'. The mismatch caused cloned containers to
silently keep the source template's SSH host keys.
2026-06-27 23:19:26 -04:00
patrick 4f09e886c2 feat(proxmox_lxc_provision): support custom bridge, interface name, and VLAN tag
The bridge (vmbr0) and interface name (eth0) were previously hardcoded
in the netif string, and there was no way to set an 802.1Q VLAN tag.
Expose lxc_bridge, lxc_iface_name, and lxc_vlan_tag (optional) so
containers can be attached to non-default bridges or tagged into a VLAN
without forking the role.

Also drop the misleading 'lxc_ipv6 | default(omit)' filter — default(omit)
does not produce omission inside a string context, and lxc_ipv6 always
has a default of 'auto' in defaults/main.yml.
2026-06-27 21:23:14 -04:00
patrick a0f9b06da9 refactor(system_setup): rename bare 'password' var to user_password
The bare 'password' variable in user.yml could silently collide with any
same-named variable elsewhere in scope. Rename to user_password to
namespace it alongside username.

BREAKING CHANGE: callers passing 'password' to this role must rename it
to user_password.
2026-06-27 21:11:25 -04:00
patrick 51c1c5b611 refactor(proxmox_lxc_provision): rename password vars and parameterize user name
Rename lxc_password to lxc_root_password for consistency with the new
lxc_user_password (replaces the previously bare 'password' variable in
post-clone.yml, which silently collided with any same-named caller var).
Add lxc_user_name (default: admin) so the non-root account managed in
post-clone.yml is no longer hardcoded. Apply default(omit) to the root
password in create.yml so it is genuinely optional as documented.

BREAKING CHANGE: callers passing lxc_password or a bare 'password' var
must rename to lxc_root_password and lxc_user_password respectively.
2026-06-27 21:11:13 -04:00
patrick 27924cf55c docs(proxmox_lxc_provision): document missing task files and optional variables
Add post-clone.yml and edit-config.yml to the task list, and document
the previously undocumented optional variables (lxc_unprivileged,
lxc_mounts, lxc_onboot, lxc_startup, lxc_timezone, lxc_nvidia_gpu_mount,
gpu_device_id, uvm_device_id, lxc_id_mappings).
2026-06-27 21:09:27 -04:00
patrick 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
patrick ce7ec1b25f fix: correct file extension from .yaml to .yml 2026-04-15 19:23:43 -04:00
patrick 441b9fa824 refactor: Update check-exists.yml to check by vmid or hostname 2026-04-14 19:08:28 -04:00
patrick 9d7f702f2a refactor: add variable for delegating to proxmox host 2026-04-14 18:43:43 -04:00
patrick 6e6bed6a40 fix: change proxmox info module to proxmox_vm_info from proxmox_lxc_info 2026-04-14 17:52:24 -04:00
patrick 3a2b4b8775 chore: migrate proxmox module from community.general.proxmox to community.proxmox 2026-04-14 17:40:03 -04:00
patrick 479996612e 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
2026-04-14 17:18:18 -04:00
patrick 570eba84e7 fix: add execute permissions to task 2026-04-14 15:25:16 -04:00
patrick 62f4a3ea73 fix: rename roles to use underscores instead of hyphens which was causing the roles not to be found 2026-04-14 15:19:21 -04:00
patrick b2379e597e chore: rename .yaml extensions to .yml for consistency 2026-04-14 13:32:39 -04:00
patrick ac3859047c feat: task for checking existence of a LXC by hostname 2026-04-14 13:31:36 -04:00
hiperman 0a52e32f42 renamed vars to use 'lxc' prefix instead of 'container' 2026-01-31 18:42:23 -05:00
hiperman 60fbe461be update docs 2026-01-30 20:16:06 -05:00
hiperman a28fcbd942 initial commit 2026-01-30 20:13:58 -05:00