community.general icon indicating copy to clipboard operation
community.general copied to clipboard

proxmox_kvm: can't check if VM exists

Open Vanav opened this issue 1 year ago • 16 comments

Summary

I want to check if VM exists by its name (to workaround another issue #1964). But it fails if VM doesn't exist.

Steps to Reproduce

- name: Check if VM exists
  proxmox_kvm:
    api_host: '{{ proxmox_api_host }}'
    api_user: '{{ proxmox_api_user }}'
    api_password: '{{ proxmox_api_password }}'
    node: pve
    name: fresh-ubuntu-22
    state: current
  delegate_to: localhost

Actual Results

fatal: [fresh_ubuntu_22_node -> localhost]: FAILED! => 
    changed: false
    msg: VM with name = fresh-ubuntu-22 does not exist in cluster

Expected Results

I expect to not get fatal error, but to get VM state or id.

Issue Type

Bug Report

Component Name

proxmox_kvm

Ansible Version

$ ansible --version
ansible [core 2.14.1]

Community.general Version

$ ansible-galaxy collection list community.general
community.general 6.1.0

Code of Conduct

  • [X] I agree to follow the Ansible Code of Conduct

Vanav avatar Jan 11 '23 22:01 Vanav