Closed jhofmueller closed 1 year 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.
cc @Ajpantuso @Thulium-Drake @UnderGreen @helldorado @joshainglis @karmab click here for bot help
The only explanation from the code I see: you have no VM with the name ubuntu
in a cluster. The function which collects vmid for that name returned 0 results and that led to fail.
I'm terribly sorry but that doesn't work for me. I can confirm that the VM in question exists (it's a template, but that should not matter, right?) but the same error keeps popping up.
The only thing that comes to my mind is that our cluster has only one node. But that should not be a problem, right?
With the current main branch code I can clone the VM and don't see any problem.
TASK [Clone new VM] ****************************************************************************************************************************************
changed: [localhost] => {"changed": true, "msg": "VM pxe-cloned.home.arpa with newid 104 cloned from vm with vmid 100", "vmid": "104"}
PLAY RECAP *************************************************************************************************************************************************
localhost : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
There could be an explanation for your case. Invisible space character in the name or any UTF character which looks like a Latin letter. You can use proxmox_vm_info
module to get all VMs information and copy the exact name from the console output.
That was not the problem either. I did some more debugging and found the following:
proxmoxer
module.proxmox_vm_info
.I have no explanation for this behavior and will sleep over it one more night. Thanks for your support so far!
$ ansible-galaxy collection list community.general
# /home/USER/.ansible/collections/ansible_collections
Collection Version
----------------- -------
community.general 7.1.0
# /usr/lib/python3/dist-packages/ansible_collections
Collection Version
----------------- -------
community.general 4.8.3
Just to rule out that it is not a problem with multiple collections used I would recommend next steps to try:
I think after that ansible-core installation must use your 7.1.0 community.general collection.
That is not it either. Furthermore, I had to upgrade to community.general 7.2.1 in order to be able to use the proxmox_vm_info
module. So I can assure that the most recent version of community.general is being used.
Just to clarify: proxmoxer
is installed on the proxmox node, not on my workstation that runs the playbook.
proxmoxer library should be installed there, where you set your hosts:
in a playbook. If you don't set, then localhost is assumed, which is your workstation in that case.
I am still at a loss here :cry: I can create a VM using proxmox_kvm
. I cannot get a list of the VMs on the node using proxmox_vm_info
. Hence I can also not clone an existing VM.
No clue what is wrong here. Since creating VMs works the basic setup including permissions must be correct, right? I am using a token linked to the root user and no privilege separation for these tests.
I encountered this same issue with community.general
collection 7.5.0, ansible-core
2.15.5, Python 3.10.12. I only encountered this issue when using API keys - using just api_user
and api_password
works fine, but api_token_id
and api_token_secret
does not work.
Thanks for your message! I tried it again today and low and behold, it worked as expected. I still have the same ansible environment but my proxmox cluster has been upgrade multiple times and run's the most recent software. I have no clue what went wrong or where the error was hidden.
Summary
When I try to clone a new VM from an existing template named "ubuntu" I get the error "VM with name = ubuntu does not exist in cluster". This is the task:
Issue Type
Bug Report
Component Name
proxmox_kvm
Ansible Version
Community.general Version
Configuration
OS / Environment
Ubuntu 22.04.2
Steps to Reproduce
Expected Results
I expected a new VM cloned from the specified template.
Actual Results
Code of Conduct