ansible-collections / community.general

Ansible Community General Collection
https://galaxy.ansible.com/ui/repo/published/community/general/
GNU General Public License v3.0
784 stars 1.45k forks source link

Removing vm from proxmox fails if it is in a HA resource #8559

Open ajw1980 opened 1 week ago

ajw1980 commented 1 week ago

Summary

Similar to lxc removal in #1488, using proxmox_kvm to remove a guest that has HA resources doesn't work:

deletion of VM 100 failed with exception: 500 Internal Server Error: unable to remove VM 100 - used in HA resources and purge parameter not set. 

I added purge=1 to the qemu.delete() call in proxmox_kvm.py to allow this to work.

Issue Type

Bug Report

Component Name

proxmox_kvm

Ansible Version

ansible [core 2.15.8]
  config file = /home/andy.wettstein/admin-scripts/ansible/ansible.cfg
  configured module search path = ['/home/andy.wettstein/admin-scripts/ansible/plugins/modules']
  ansible python module location = /install/software/ansible/ansible-8.7/lib/python3.9/site-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /install/software/ansible/ansible-8.7/bin/ansible
  python version = 3.9.16 (main, Jul  3 2023, 20:07:32) [GCC 8.5.0 20210514 (Red Hat 8.5.0-18)] (/usr/bin/python3.9)
  jinja version = 3.1.3
  libyaml = True

Community.general Version

Collection        Version
----------------- -------
community.general 7.5.2

Configuration

No response

OS / Environment

No response

Steps to Reproduce

Add a proxmox VM to an ha resource and try to remove it with something like this:

- name: '{{ state }} VM {{ hostname }}'
  community.general.proxmox_kvm:
    api_user: "{{ proxmox_api_user }}"
    api_token_id: "{{ proxmox_api_token_id }}"
    api_token_secret: "{{ proxmox_api_token_secret }}"
    api_host: proxmox-host
    name: vmname
    state: absent
    force: true
    timeout: 60
  delegate_to: localhost
  register: vm_state

Expected Results

It should be possible to remove the VM.

Actual Results

Code of Conduct

ansibullbot commented 1 week ago

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

ansibullbot commented 1 week ago

cc @Ajpantuso @Thulium-Drake @UnderGreen @helldorado @joshainglis @karmab @krauthosting click here for bot help