--- # Here, not in validate.yml: whether a clone happens is known only after the API lookup. - name: Assert the template to clone is set ansible.builtin.assert: that: - pve_vm_clone_vmid is defined fail_msg: >- VM {{ pve_vm_vmid }} does not exist on {{ pve_vm_node }}, so it is cloned, which needs pve_vm_clone_vmid, the VM id of the template. Set it, or create the VM by other means. quiet: true - name: Clone VM from template no_log: true # carries the API token secret delegate_to: "{{ pve_vm_delegate }}" community.proxmox.proxmox_kvm: node: "{{ pve_vm_node }}" clone: template vmid: "{{ pve_vm_clone_vmid }}" newid: "{{ pve_vm_vmid }}" name: "{{ inventory_hostname | lower | replace('_', '-') }}" full: "{{ pve_vm_full_clone }}" timeout: 600 state: present register: __pve_vm_clone - name: Record that the VM was just cloned ansible.builtin.set_fact: # Forces one cloud-init update (ciuser, sshkeys) in update.yml. __pve_vm_created: "{{ __pve_vm_clone is changed }}"