feat(pve_vm): add the pve_vm role #482

Open
opened 2026-11-29 18:11:23 +00:00 by Claude · 0 comments
Owner

Problem

The README Roadmap lists pve_vm as the last role still to come. It manages the lifecycle of a Proxmox VE QEMU VM through the API: clone from a template, cloud-init settings (user, SSH keys, network), boot disk resize, drift detection and update of an existing VM, and destroy behind an explicit opt-in. No role in the Collection covers QEMU VMs yet.

Proposal

Add a pve_vm role, shaped like pve_lxc.

Decisions (maintainer, 2026-11-29):

  1. Platform: the declared platforms are the guest OS, Ubuntu noble and resolute (roles/AGENTS.md), not the Proxmox node.

  2. Interface: pve_vm_* inputs. Input checks go in a validate task file imported first with tags: always. There is no legacy-name guard. pve_vm_api_token_secret has no default and is asserted non-empty when the lifecycle is managed.

  3. pve_vm_reboot_if_required is a real input (bool, default true) with an argument spec entry.

  4. Facts: only pve_vm_exists is public. Every other fact and registered result, and the internal API auth header, carry the __pve_vm_ prefix.

  5. pve_vm_api_host defaults to the ansible_host of pve_vm_node from hostvars, as pve_lxc does. The README documents it and says to set it explicitly when the node is not in inventory.

  6. Credentials: the role never sets a cloud-init password (cipassword). On a real run it deletes one stored on the VM, with no_log. Every task carrying a secret is no_log.

  7. Check mode: proxmox_kvm and proxmox_disk have no check-mode support. --check previews through the role's own drift report and creation preview. The README says that a play-level check_mode: true is not supported.

  8. Testing: offline, no Proxmox API. The molecule scenario includes the role's task files directly, as the pve_lxc scenario does:

    • validate, with positive cases and the refusal cases through the failed-run pattern;
    • drift detection on a seeded VM config, including the cloud-init user and SSH-key cases;
    • the guest-side cloud-init wait, if the test image ships cloud-init (otherwise the README says it is not exercised).

    Verify asserts, statically over the role's task files, that no community.proxmox.proxmox_kvm task carries cipassword and that the task deleting a stored cipassword is no_log. The API lifecycle (clone, update, resize, destroy) is not exercised, and the README says so in one line.

  9. README in the roles layout. It covers:

    • the needed API privileges (VM.Allocate, VM.Clone, VM.Config.*, VM.Audit, Datastore.AllocateSpace, SDN.Use where networks are set);
    • that a token with privilege separation needs the ACL on both the user and the token;
    • the proxmoxer >= 2.3 and requests requirement on the controller.
  10. Content stands alone: no host, group or inventory names, no issue references to other trackers, and no description of any particular environment, in the role, its README, comments or argument specs.

Acceptance criteria

  • roles/pve_vm exists with tasks/main.yml, a validate task file, defaults/main.yml, meta/main.yml (namespace mortis, min_ansible_version 2.22, platforms Ubuntu noble and resolute), meta/argument_specs.yml with a matching default for every optional input, and a README in the roles layout.
  • Only pve_vm_exists is a public fact; pve_vm_reboot_if_required has default true and a spec entry; there is no legacy-name guard.
  • No task sets cipassword; the stored-password delete and every secret-carrying task are no_log.
  • roles/pve_vm/molecule/default runs validate (with refusal cases), seeded drift detection and, where the image allows, the cloud-init wait; verify holds the two static cipassword assertions; check runs before and after converge.
  • A grep of the role (molecule excluded) for host and group names, inventory paths, #NNN references and IPv4 addresses returns only documentation addresses and generic examples; the command and result are in the PR.
  • A minor_changes fragment announces the role; the README Roadmap section is removed (this is its last role) and the lists of roles held are updated; the scenario has an entry in the molecule duration list.
  • CI on the pull request is green, including the pve_vm scenario.

Order

  • PR: add the pve_vm role with its molecule scenario, README, Roadmap removal, and a minor_changes fragment
  • Release 3.3.0 (separate issue)

🤖 Generated with Claude Code

## Problem The README Roadmap lists `pve_vm` as the last role still to come. It manages the lifecycle of a Proxmox VE QEMU VM through the API: clone from a template, cloud-init settings (user, SSH keys, network), boot disk resize, drift detection and update of an existing VM, and destroy behind an explicit opt-in. No role in the Collection covers QEMU VMs yet. ## Proposal Add a `pve_vm` role, shaped like `pve_lxc`. Decisions (maintainer, 2026-11-29): 1. **Platform:** the declared platforms are the guest OS, Ubuntu `noble` and `resolute` (roles/AGENTS.md), not the Proxmox node. 2. **Interface:** `pve_vm_*` inputs. Input checks go in a validate task file imported first with `tags: always`. There is no legacy-name guard. `pve_vm_api_token_secret` has no default and is asserted non-empty when the lifecycle is managed. 3. **`pve_vm_reboot_if_required`** is a real input (bool, default `true`) with an argument spec entry. 4. **Facts:** only `pve_vm_exists` is public. Every other fact and registered result, and the internal API auth header, carry the `__pve_vm_` prefix. 5. **`pve_vm_api_host`** defaults to the `ansible_host` of `pve_vm_node` from hostvars, as `pve_lxc` does. The README documents it and says to set it explicitly when the node is not in inventory. 6. **Credentials:** the role never sets a cloud-init password (`cipassword`). On a real run it deletes one stored on the VM, with `no_log`. Every task carrying a secret is `no_log`. 7. **Check mode:** `proxmox_kvm` and `proxmox_disk` have no check-mode support. `--check` previews through the role's own drift report and creation preview. The README says that a play-level `check_mode: true` is not supported. 8. **Testing: offline, no Proxmox API.** The molecule scenario includes the role's task files directly, as the `pve_lxc` scenario does: - validate, with positive cases and the refusal cases through the failed-run pattern; - drift detection on a seeded VM config, including the cloud-init user and SSH-key cases; - the guest-side cloud-init wait, if the test image ships cloud-init (otherwise the README says it is not exercised). Verify asserts, statically over the role's task files, that no `community.proxmox.proxmox_kvm` task carries `cipassword` and that the task deleting a stored `cipassword` is `no_log`. The API lifecycle (clone, update, resize, destroy) is not exercised, and the README says so in one line. 9. **README** in the roles layout. It covers: - the needed API privileges (VM.Allocate, VM.Clone, VM.Config.*, VM.Audit, Datastore.AllocateSpace, SDN.Use where networks are set); - that a token with privilege separation needs the ACL on both the user and the token; - the proxmoxer >= 2.3 and requests requirement on the controller. 10. **Content stands alone:** no host, group or inventory names, no issue references to other trackers, and no description of any particular environment, in the role, its README, comments or argument specs. ## Acceptance criteria - [ ] `roles/pve_vm` exists with `tasks/main.yml`, a validate task file, `defaults/main.yml`, `meta/main.yml` (namespace `mortis`, `min_ansible_version` 2.22, platforms Ubuntu noble and resolute), `meta/argument_specs.yml` with a matching default for every optional input, and a README in the roles layout. - [ ] Only `pve_vm_exists` is a public fact; `pve_vm_reboot_if_required` has default `true` and a spec entry; there is no legacy-name guard. - [ ] No task sets `cipassword`; the stored-password delete and every secret-carrying task are `no_log`. - [ ] `roles/pve_vm/molecule/default` runs validate (with refusal cases), seeded drift detection and, where the image allows, the cloud-init wait; verify holds the two static `cipassword` assertions; check runs before and after converge. - [ ] A grep of the role (molecule excluded) for host and group names, inventory paths, `#NNN` references and IPv4 addresses returns only documentation addresses and generic examples; the command and result are in the PR. - [ ] A `minor_changes` fragment announces the role; the README Roadmap section is removed (this is its last role) and the lists of roles held are updated; the scenario has an entry in the molecule duration list. - [ ] CI on the pull request is green, including the `pve_vm` scenario. ## Order - [ ] PR: add the `pve_vm` role with its molecule scenario, README, Roadmap removal, and a `minor_changes` fragment - [ ] Release 3.3.0 (separate issue) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Claude added the Kind/Feature
Status
Ready for Agent
labels 2026-11-29 18:11:23 +00:00
Claude added a new dependency 2026-11-29 18:11:48 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Blocks
Reference: Mortis/Kamino#482