I am encountering a problem with AWX when I try to use the community.vmware.vmware_vm_info module to retrieve the list of VMs from a vCenter.
My code
---
- name: Récupérer la liste des VM sur vCenter
hosts: localhost
gather_facts: no
collections:
- community.vmware
vars:
vcenter_validate_certs: false
tasks:
- name: Gather all registered virtual machines
vmware_vm_info:
validate_certs: "{{ vcenter_validate_certs }}"
delegate_to: localhost
register: vm_info
- debug:
var: vm_info.virtual_machines
Result of the execution failure
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: }
fatal: [localhost]: FAILED! => {"ansible_facts": {"discovered_interpreter_python": "/usr/bin/python3"}, "changed": false, "module_stderr": "Traceback (most recent call last):\n File \"/runner/.ansible/tmp/ansible-tmp-1764691283.1468372-22-151162757697601/AnsiballZ_vmware_vm_info.py\", line 107, in <module>\n _ansiballz_main()\n File \"/runner/.ansible/tmp/ansible-tmp-1764691283.1468372-22-151162757697601/AnsiballZ_vmware_vm_info.py\", line 99, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File \"/runner/.ansible/tmp/ansible-tmp-1764691283.1468372-22-151162757697601/AnsiballZ_vmware_vm_info.py\", line 47, in invoke_module\n runpy.run_module(mod_name='ansible_collections.community.vmware.plugins.modules.vmware_vm_info', init_globals=dict(_module_fqn='ansible_collections.community.vmware.plugins.modules.vmware_vm_info', _modlib_path=modlib_path),\n Fi…
``
PLAY [Récupérer la liste des VM sur vCenter] ***********************************
TASK [Gather all registered virtual machines] **********************************
task path: /runner/project/playbooks/lister_vm2.yml:11
[WARNING]: Collection vmware.vmware does not support Ansible version 2.15.12
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: TimeoutError: [Errno 110] Connection timed out
fatal: [localhost]: FAILED! => {“changed”: false, “module_stderr”: "Traceback (most recent call last):\n File "/runner/.ansible/tmp/ansible-tmp-1764699847.962096-22-64845711897849/AnsiballZ_vmware_vm_info.py", line 107, in \n _ansiballz_main()\n File "/runner/.ansible/tmp/ansible-tmp-1764699847.962096-22-64845711897849/AnsiballZ_vmware_vm_info.py", line 99, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File "/runner/.ansible/tmp/ansible-tmp-1764699847.962096-22-64845711897849/AnsiballZ_vmware_vm_info.py", line 47, in invoke_module\n runpy.run_module(mod_name=‘ansible_collections.community.vmware.plugins.modules.vmware_vm_info’, init_globals=dict(_module_fqn=‘ansible_collections.community.vmware.plugins.modules.vmware_vm_info’, _modlib_path=modlib_path),\n File "/usr/lib64/python3.9/runpy.p…
PLAY RECAP *********************************************************************
localhost : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
As @mikemorency mentioned, it looks like you might have a connectivity issue between AWX and the vCenter.
If you build your own execution environment, and it has tooling such as telnet or openssh-client you could try using these with the command module in a playbook to check the connectivity. Alternatively, if you have access to the Kubernetes cluster which AWX is deployed on, try deploying a busybox pod and test the connectivity to vCenter that way.
A question I have is are you setting the hostname for the module via the VMWARE_HOST environment variable?