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

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

Open ajw1980 opened this issue 8 months ago • 2 comments

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

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

ajw1980 avatar Jun 25 '24 14:06 ajw1980