diff --git a/tasks/proxmox.yml b/tasks/proxmox.yml index 9a30c02..6ee046b 100644 --- a/tasks/proxmox.yml +++ b/tasks/proxmox.yml @@ -76,7 +76,7 @@ - create_vm_proxmox_configure_cloudinit | bool delegate_to: localhost -- name: Start VM +- name: Enable QEMU guest agent for VM community.general.proxmox_kvm: api_host: "{{ create_vm_proxmox_host }}" api_user: "{{ create_vm_proxmox_user }}" @@ -84,12 +84,13 @@ node: "{{ create_vm_proxmox_host }}" vmid: "{{ create_vm_proxmox_vmid }}" name: "{{ create_vm_proxmox_name }}" - state: started + agent: true + update: true when: - - create_vm_proxmox_start_vm + - create_vm_proxmox_enable_guest_agent | bool delegate_to: localhost -- name: Enable QEMU guest agent for VM +- name: Set VM to autostart community.general.proxmox_kvm: api_host: "{{ create_vm_proxmox_host }}" api_user: "{{ create_vm_proxmox_user }}" @@ -97,12 +98,14 @@ node: "{{ create_vm_proxmox_host }}" vmid: "{{ create_vm_proxmox_vmid }}" name: "{{ create_vm_proxmox_name }}" - agent: true + proxmox_default_behavior: no_defaults + onboot: true + update: true when: - - create_vm_proxmox_enable_guest_agent | bool + - create_vm_proxmox_start_vm_onboot | bool delegate_to: localhost -- name: Set VM to autostart +- name: Start VM community.general.proxmox_kvm: api_host: "{{ create_vm_proxmox_host }}" api_user: "{{ create_vm_proxmox_user }}" @@ -110,10 +113,9 @@ node: "{{ create_vm_proxmox_host }}" vmid: "{{ create_vm_proxmox_vmid }}" name: "{{ create_vm_proxmox_name }}" - proxmox_default_behavior: no_defaults - onboot: true + state: started when: - - create_vm_proxmox_start_vm_onboot | bool + - create_vm_proxmox_start_vm delegate_to: localhost ...