mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-25 14:20:22 -07:00
proxmox_kvm: fix idempotency issue with state=absent (#811)
When the `vmid` parameter is not supplied and the module can only rely on name look-up an early failure can happen if the targeted VM doesn't exist. In this case a task execution with the parameter `state` set to `absent` will actually fail instead of being considered ok. This patch introduces a deferred error-checking for non-existent VMs by assigning the value -1 to the `vmid` parameter, allowing the actual verification to be performed in the right code paths. Is also help to differentiate between a non-existent `vmid` or non-existent VM `name`. Previously: TASK [ansible-role-proxmox-instance : Remove instance-test] changed: [localhost] ... TASK [ansible-role-proxmox-instance : Remove instance-test] fatal: [localhost]: FAILED! => changed=false msg: VM instance-test does not exist in cluster. Now: TASK [ansible-role-proxmox-instance : Remove instance-test] ok: [localhost] ... TASK [ansible-role-proxmox-instance : Remove instance-test] ok: [localhost] Update changelogs/fragments/811-proxmox-kvm-state-absent.yml With suggestions from Felix Fontein <felix@fontein.de>.
This commit is contained in:
parent
8a16b51202
commit
73f8338980
2 changed files with 51 additions and 35 deletions
3
changelogs/fragments/811-proxmox-kvm-state-absent.yml
Normal file
3
changelogs/fragments/811-proxmox-kvm-state-absent.yml
Normal file
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
bugfixes:
|
||||
- proxmox_kvm - defer error-checking for non-existent VMs in order to fix idempotency of tasks using ``state=absent`` and properly recognize a success (https://github.com/ansible-collections/community.general/pull/811).
|
Loading…
Add table
Add a link
Reference in a new issue