- set_fact: node_name="{{tmp_node}}" - set_fact: vm_name="{{node_name}}.{{stack.name}}" - set_fact: kvm_timeout: 500 - name: checking that vm exists proxmox_kvm: node: pve api_user: "{{env.pve.username}}" api_password: "{{env.pve.password}}" api_host: "{{env.pve.api_url}}" name: "{{vm_name}}" state: current ignore_errors: true register: vm_exists - block: - name: stopping vm proxmox_kvm: node: pve api_user: "{{env.pve.username}}" api_password: "{{env.pve.password}}" api_host: "{{env.pve.api_url}}" name: "{{vm_name}}" state: stopped force: yes timeout: "{{ kvm_timeout }}" - name: destroying vm proxmox_kvm: node: pve api_user: "{{env.pve.username}}" api_password: "{{env.pve.password}}" api_host: "{{env.pve.api_url}}" name: "{{vm_name}}" state: absent timeout: "{{ kvm_timeout }}" when: vm_exists is succeeded