--- - name: Check if VM already exists community.proxmox.proxmox_kvm: validate_certs: false node: proxmox-server api_user: root@pam api_host: 192.168.0.2 api_token_id: ansible api_token_secret: "{{ proxmox_token_secret }}" name: "{{ vm_hostname }}" state: current ignore_errors: true register: vm_status - name: Create a new VM with minimal options only if it doesn't exist when: vm_status is failed or 'does not exist in cluster' in vm_status.msg ansible.builtin.include_tasks: create_vm.yaml - name: Start the VM only if needed when: '"does not exist in cluster" in vm_status.msg or vm_status.status != "running"' ansible.builtin.include_tasks: start_vm.yaml