Open pandalec opened 1 year ago
Same issue but only with
{{ lookup('vmware.vmware_rest.datastore_moid', '{{ datastore_path }}') }}"
Tested with cloud.common 2.0.4 and 2.1.3
error in cloud.common 2.0.4 :
Loading collection cloud.common from /ansible/collection/ansible_collections/cloud/common
exception during Jinja2 execution: Traceback (most recent call last):
File "/lib/python3.10/site-packages/ansible/template/__init__.py", line 831, in _lookup
ran = instance.run(loop_terms, variables=self._available_variables, **kwargs)
File "/ansible/collection/ansible_collections/cloud/common/plugins/plugin_utils/turbo/lookup.py", line 31, in run_on_daemon
return self.execute(terms=terms, variables=variables, **kwargs)
File "/ansible/collection/ansible_collections/cloud/common/plugins/plugin_utils/turbo/lookup.py", line 57, in execute
with ansible_collections.cloud.common.plugins.module_utils.turbo.common.connect(
File "/usr/local/lib/python3.10/contextlib.py", line 135, in __enter__
return next(self.gen)
File "/ansible/collection/ansible_collections/cloud/common/plugins/module_utils/turbo/common.py", line 95, in connect
turbo_socket.bind()
File "/ansible/collection/ansible_collections/cloud/common/plugins/module_utils/turbo/common.py", line 27, in bind
self._socket.connect(self._socket_path)
FileNotFoundError: [Errno 2] No such file or directory
fatal: [HIDEN]: FAILED! =>
msg: 'An unhandled exception occurred while running the lookup plugin ''vmware.vmware_rest.datastore_moid''. Error was a <class ''FileNotFoundError''>, original message: [Errno 2] No such file or directory. [Errno 2] No such file or directory'
Same issue with vmware.vmware_rest.vcenter_vm_power. As noted, stack trace indicates issue percolating from cloud.common.
Collection Version
cloud.common 2.1.3 vmware.vmware_rest 2.3.1
ansible [core 2.14.4] config file = /etc/ansible/ansible.cfg configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] ansible python module location = /usr/lib/python3.9/site-packages/ansible ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections executable location = /usr/bin/ansible python version = 3.9.13 (main, Nov 9 2022, 13:16:24) [GCC 8.5.0 20210514 (Red Hat 8.5.0-15)] (/usr/bin/python3.9) jinja version = 3.1.2 libyaml = True
The full traceback is:
Traceback (most recent call last):\r
File "/home/ansible/.ansible/tmp/ansible-tmp-1683301646.3150833-99-269542372869278/AnsiballZ_vcenter_vm_power.py", line 107, in
@pandalec @cbreuil-orange @idontevenreallycare
This issue occurred when the turbo daemon is not able to booted, therefore the socket is not created and when the client tried to connect it failed with 'FileNotFoundError'
Actually this can happen for many reasons, could you please try to run again the module using the cloud.common
version of this pull request https://github.com/ansible-collections/cloud.common/pull/128 ?
Thanks
Hi there,
Faced with similar issue for vmware.vmware_rest.vcenter_vm_power_info
module.
Ansible 2.15, 2.16.
Python 3.10
Ansible launched from venv.
Playbook is something like next:
- name: Deploy nodes for development rancher cluster from scratch
hosts: localhost
gather_facts: false
tasks:
- name: Deploy VMs
ansible.builtin.include_role:
name: "vmware"
with_items:
- "{{ groups['rancher_devel'] }}"
vars:
BASE_OS: ubuntu
However, when launching the next one playbook, everything seems good:
- name: Deploy Ubuntu vm from scratch
hosts: localhost
become: false
gather_facts: false
roles:
- role: "vmware"
vars:
BASE_OS: ubuntu
Task which actually failed
- name: Get VM power state
vmware.vmware_rest.vcenter_vm_power_info:
vcenter_hostname: '{{ VMWARE_VC_URL }}'
vcenter_username: '{{ VMWARE_VC_USER }}'
vcenter_password: '{{ VMWARE_VC_PASSWORD }}'
vcenter_validate_certs: '{{ VMWARE_VALIDATE_CERTS }}'
vm: '{{ INSTANCE_MOID }}'
register: VM_POWER_STATE
Trace log:
TASK [vmware : Get VM power state] **********
task path: /home/kastakhov/ansible/roles/vmware/tasks/deploy-ubuntu-ova.yml:91
Sunday 28 January 2024 22:52:10 +0000 (0:00:00.235) 0:01:24.968 ********
<127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: kastakhov
<127.0.0.1> EXEC /bin/sh -c 'echo ~kastakhov && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/kastakhov/.ansible/tmp `"&& mkdir "` echo /home/kastakhov/.ansible/tmp/ansible-tmp-1706482331.006034-193421-240807273215394 `" && echo ansible-tmp-1706482331.006034-193421-240807273215394="` echo /home/kastakhov/.ansible/tmp/ansible-tmp-1706482331.006034-193421-240807273215394 `" ) && sleep 0'
Using module file /home/kastakhov/ansible/venv/lib/python3.10/site-packages/ansible_collections/vmware/vmware_rest/plugins/modules/vcenter_vm_power_info.py
<127.0.0.1> PUT /home/kastakhov/.ansible/tmp/ansible-local-193032au24zcln/tmpfp6pq5ib TO /home/kastakhov/.ansible/tmp/ansible-tmp-1706482331.006034-193421-240807273215394/AnsiballZ_vcenter_vm_power_info.py
<127.0.0.1> EXEC /bin/sh -c 'chmod u+x /home/kastakhov/.ansible/tmp/ansible-tmp-1706482331.006034-193421-240807273215394/ /home/kastakhov/.ansible/tmp/ansible-tmp-1706482331.006034-193421-240807273215394/AnsiballZ_vcenter_vm_power_info.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c 'sudo -H -S -n -u root /bin/sh -c '"'"'echo BECOME-SUCCESS-uuuoolwakdidboilotjvgcbixrxufcam ; /home/kastakhov/ansible/venv/bin/python3 /home/kastakhov/.ansible/tmp/ansible-tmp-1706482331.006034-193421-240807273215394/AnsiballZ_vcenter_vm_power_info.py'"'"' && sleep 0'
<127.0.0.1> EXEC /bin/sh -c 'rm -f -r /home/kastakhov/.ansible/tmp/ansible-tmp-1706482331.006034-193421-240807273215394/ > /dev/null 2>&1 && sleep 0'
The full traceback is:
Traceback (most recent call last):
File "/home/kastakhov/.ansible/tmp/ansible-tmp-1706482331.006034-193421-240807273215394/AnsiballZ_vcenter_vm_power_info.py", line 107, in <module>
_ansiballz_main()
File "/home/kastakhov/.ansible/tmp/ansible-tmp-1706482331.006034-193421-240807273215394/AnsiballZ_vcenter_vm_power_info.py", line 99, in _ansiballz_main
invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
File "/home/kastakhov/.ansible/tmp/ansible-tmp-1706482331.006034-193421-240807273215394/AnsiballZ_vcenter_vm_power_info.py", line 47, in invoke_module
runpy.run_module(mod_name='ansible_collections.vmware.vmware_rest.plugins.modules.vcenter_vm_power_info', init_globals=dict(_module_fqn='ansible_collections.vmware.vmware_rest.plugins.modules.vcenter_vm_power_info', _modlib_path=modlib_path),
File "/usr/lib/python3.10/runpy.py", line 224, in run_module
return _run_module_code(code, init_globals, run_name, mod_spec)
File "/usr/lib/python3.10/runpy.py", line 96, in _run_module_code
_run_code(code, mod_globals, init_globals,
File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/tmp/ansible_vmware.vmware_rest.vcenter_vm_power_info_payload_85rwa70y/ansible_vmware.vmware_rest.vcenter_vm_power_info_payload.zip/ansible_collections/vmware/vmware_rest/plugins/modules/vcenter_vm_power_info.py", line 232, in <module>
File "/usr/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
return future.result()
File "/tmp/ansible_vmware.vmware_rest.vcenter_vm_power_info_payload_85rwa70y/ansible_vmware.vmware_rest.vcenter_vm_power_info_payload.zip/ansible_collections/vmware/vmware_rest/plugins/modules/vcenter_vm_power_info.py", line 181, in main
File "/tmp/ansible_vmware.vmware_rest.vcenter_vm_power_info_payload_85rwa70y/ansible_vmware.vmware_rest.vcenter_vm_power_info_payload.zip/ansible_collections/cloud/common/plugins/module_utils/turbo/module.py", line 119, in __init__
File "/tmp/ansible_vmware.vmware_rest.vcenter_vm_power_info_payload_85rwa70y/ansible_vmware.vmware_rest.vcenter_vm_power_info_payload.zip/ansible_collections/cloud/common/plugins/module_utils/turbo/module.py", line 143, in run_on_daemon
File "/usr/lib/python3.10/contextlib.py", line 135, in __enter__
return next(self.gen)
File "/tmp/ansible_vmware.vmware_rest.vcenter_vm_power_info_payload_85rwa70y/ansible_vmware.vmware_rest.vcenter_vm_power_info_payload.zip/ansible_collections/cloud/common/plugins/module_utils/turbo/common.py", line 122, in connect
File "/tmp/ansible_vmware.vmware_rest.vcenter_vm_power_info_payload_85rwa70y/ansible_vmware.vmware_rest.vcenter_vm_power_info_payload.zip/ansible_collections/cloud/common/plugins/module_utils/turbo/common.py", line 54, in bind
FileNotFoundError: [Errno 2] No such file or directory
fatal: [localhost]: FAILED! => {
"changed": false,
"module_stderr": "Traceback (most recent call last):\n File \"/home/kastakhov/.ansible/tmp/ansible-tmp-1706482331.006034-193421-240807273215394/AnsiballZ_vcenter_vm_power_info.py\", line 107, in <module>\n _ansiballz_main()\n File \"/home/kastakhov/.ansible/tmp/ansible-tmp-1706482331.006034-193421-240807273215394/AnsiballZ_vcenter_vm_power_info.py\", line 99, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File \"/home/kastakhov/.ansible/tmp/ansible-tmp-1706482331.006034-193421-240807273215394/AnsiballZ_vcenter_vm_power_info.py\", line 47, in invoke_module\n runpy.run_module(mod_name='ansible_collections.vmware.vmware_rest.plugins.modules.vcenter_vm_power_info', init_globals=dict(_module_fqn='ansible_collections.vmware.vmware_rest.plugins.modules.vcenter_vm_power_info', _modlib_path=modlib_path),\n File \"/usr/lib/python3.10/runpy.py\", line 224, in run_module\n return _run_module_code(code, init_globals, run_name, mod_spec)\n File \"/usr/lib/python3.10/runpy.py\", line 96, in _run_module_code\n _run_code(code, mod_globals, init_globals,\n File \"/usr/lib/python3.10/runpy.py\", line 86, in _run_code\n exec(code, run_globals)\n File \"/tmp/ansible_vmware.vmware_rest.vcenter_vm_power_info_payload_85rwa70y/ansible_vmware.vmware_rest.vcenter_vm_power_info_payload.zip/ansible_collections/vmware/vmware_rest/plugins/modules/vcenter_vm_power_info.py\", line 232, in <module>\n File \"/usr/lib/python3.10/asyncio/base_events.py\", line 649, in run_until_complete\n return future.result()\n File \"/tmp/ansible_vmware.vmware_rest.vcenter_vm_power_info_payload_85rwa70y/ansible_vmware.vmware_rest.vcenter_vm_power_info_payload.zip/ansible_collections/vmware/vmware_rest/plugins/modules/vcenter_vm_power_info.py\", line 181, in main\n File \"/tmp/ansible_vmware.vmware_rest.vcenter_vm_power_info_payload_85rwa70y/ansible_vmware.vmware_rest.vcenter_vm_power_info_payload.zip/ansible_collections/cloud/common/plugins/module_utils/turbo/module.py\", line 119, in __init__\n File \"/tmp/ansible_vmware.vmware_rest.vcenter_vm_power_info_payload_85rwa70y/ansible_vmware.vmware_rest.vcenter_vm_power_info_payload.zip/ansible_collections/cloud/common/plugins/module_utils/turbo/module.py\", line 143, in run_on_daemon\n File \"/usr/lib/python3.10/contextlib.py\", line 135, in __enter__\n return next(self.gen)\n File \"/tmp/ansible_vmware.vmware_rest.vcenter_vm_power_info_payload_85rwa70y/ansible_vmware.vmware_rest.vcenter_vm_power_info_payload.zip/ansible_collections/cloud/common/plugins/module_utils/turbo/common.py\", line 122, in connect\n File \"/tmp/ansible_vmware.vmware_rest.vcenter_vm_power_info_payload_85rwa70y/ansible_vmware.vmware_rest.vcenter_vm_power_info_payload.zip/ansible_collections/cloud/common/plugins/module_utils/turbo/common.py\", line 54, in bind\nFileNotFoundError: [Errno 2] No such file or directory\n",
"module_stdout": "",
"msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
"rc": 1
}
@abikouo, if it still valid, I can check with changes from the mentioned PR.
Hi @kastakhov
Thanks for the details, Yes the PR is still valid, could you please run your playbook using this PR code (cloud.common
https://github.com/ansible-collections/cloud.common/pull/128 ?)?
Actually still failing, even after applying patch.
TASK [vmware : Get VM power state] *********************************************
task path: /home/kastakhov/test/ansible/roles/vmware/tasks/deploy-ubuntu-ova.yml:97
Monday 29 January 2024 20:46:39 +0000 (0:00:00.032) 0:01:24.145 ********
<127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: kastakhov
<127.0.0.1> EXEC /bin/sh -c 'echo ~kastakhov && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/kastakhov/.ansible/tmp `"&& mkdir "` echo /home/kastakhov/.ansible/tmp/ansible-tmp-1706561199.803331-243107-223799634902501 `" && echo ansible-tmp-1706561199.803331-243107-223799634902501="` echo /home/kastakhov/.ansible/tmp/ansible-tmp-1706561199.803331-243107-223799634902501 `" ) && sleep 0'
Loading collection cloud.common from /home/kastakhov/test/ansible/venv/lib/python3.10/site-packages/ansible_collections/cloud/common
Using module file /home/kastakhov/test/ansible/venv/lib/python3.10/site-packages/ansible_collections/vmware/vmware_rest/plugins/modules/vcenter_vm_power_info.py
<127.0.0.1> PUT /home/kastakhov/.ansible/tmp/ansible-local-2426729rn4ocj2/tmpqrq_q7ah TO /home/kastakhov/.ansible/tmp/ansible-tmp-1706561199.803331-243107-223799634902501/AnsiballZ_vcenter_vm_power_info.py
<127.0.0.1> EXEC /bin/sh -c 'chmod u+x /home/kastakhov/.ansible/tmp/ansible-tmp-1706561199.803331-243107-223799634902501/ /home/kastakhov/.ansible/tmp/ansible-tmp-1706561199.803331-243107-223799634902501/AnsiballZ_vcenter_vm_power_info.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c 'sudo -H -S -n -u root /bin/sh -c '"'"'echo BECOME-SUCCESS-cyrfuciveurffsfwyipdzstijrayitqs ; /home/kastakhov/test/ansible/venv/bin/python3 /home/kastakhov/.ansible/tmp/ansible-tmp-1706561199.803331-243107-223799634902501/AnsiballZ_vcenter_vm_power_info.py'"'"' && sleep 0'
<127.0.0.1> EXEC /bin/sh -c 'rm -f -r /home/kastakhov/.ansible/tmp/ansible-tmp-1706561199.803331-243107-223799634902501/ > /dev/null 2>&1 && sleep 0'
The full traceback is:
Traceback (most recent call last):
File "/home/kastakhov/.ansible/tmp/ansible-tmp-1706561199.803331-243107-223799634902501/AnsiballZ_vcenter_vm_power_info.py", line 107, in <module>
_ansiballz_main()
File "/home/kastakhov/.ansible/tmp/ansible-tmp-1706561199.803331-243107-223799634902501/AnsiballZ_vcenter_vm_power_info.py", line 99, in _ansiballz_main
invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
File "/home/kastakhov/.ansible/tmp/ansible-tmp-1706561199.803331-243107-223799634902501/AnsiballZ_vcenter_vm_power_info.py", line 47, in invoke_module
runpy.run_module(mod_name='ansible_collections.vmware.vmware_rest.plugins.modules.vcenter_vm_power_info', init_globals=dict(_module_fqn='ansible_collections.vmware.vmware_rest.plugins.modules.vcenter_vm_power_info', _modlib_path=modlib_path),
File "/usr/lib/python3.10/runpy.py", line 224, in run_module
return _run_module_code(code, init_globals, run_name, mod_spec)
File "/usr/lib/python3.10/runpy.py", line 96, in _run_module_code
_run_code(code, mod_globals, init_globals,
File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/tmp/ansible_vmware.vmware_rest.vcenter_vm_power_info_payload_x93q4i75/ansible_vmware.vmware_rest.vcenter_vm_power_info_payload.zip/ansible_collections/vmware/vmware_rest/plugins/modules/vcenter_vm_power_info.py", line 232, in <module>
File "/usr/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
return future.result()
File "/tmp/ansible_vmware.vmware_rest.vcenter_vm_power_info_payload_x93q4i75/ansible_vmware.vmware_rest.vcenter_vm_power_info_payload.zip/ansible_collections/vmware/vmware_rest/plugins/modules/vcenter_vm_power_info.py", line 181, in main
File "/tmp/ansible_vmware.vmware_rest.vcenter_vm_power_info_payload_x93q4i75/ansible_vmware.vmware_rest.vcenter_vm_power_info_payload.zip/ansible_collections/cloud/common/plugins/module_utils/turbo/module.py", line 120, in __init__
File "/tmp/ansible_vmware.vmware_rest.vcenter_vm_power_info_payload_x93q4i75/ansible_vmware.vmware_rest.vcenter_vm_power_info_payload.zip/ansible_collections/cloud/common/plugins/module_utils/turbo/module.py", line 145, in run_on_daemon
File "/usr/lib/python3.10/contextlib.py", line 135, in __enter__
return next(self.gen)
File "/tmp/ansible_vmware.vmware_rest.vcenter_vm_power_info_payload_x93q4i75/ansible_vmware.vmware_rest.vcenter_vm_power_info_payload.zip/ansible_collections/cloud/common/plugins/module_utils/turbo/common.py", line 132, in connect
File "/tmp/ansible_vmware.vmware_rest.vcenter_vm_power_info_payload_x93q4i75/ansible_vmware.vmware_rest.vcenter_vm_power_info_payload.zip/ansible_collections/cloud/common/plugins/module_utils/turbo/common.py", line 54, in bind
FileNotFoundError: [Errno 2] No such file or directory
fatal: [localhost]: FAILED! => {
"changed": false,
"module_stderr": "Traceback (most recent call last):\n File \"/home/kastakhov/.ansible/tmp/ansible-tmp-1706561199.803331-243107-223799634902501/AnsiballZ_vcenter_vm_power_info.py\", line 107, in <module>\n _ansiballz_main()\n File \"/home/kastakhov/.ansible/tmp/ansible-tmp-1706561199.803331-243107-223799634902501/AnsiballZ_vcenter_vm_power_info.py\", line 99, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File \"/home/kastakhov/.ansible/tmp/ansible-tmp-1706561199.803331-243107-223799634902501/AnsiballZ_vcenter_vm_power_info.py\", line 47, in invoke_module\n runpy.run_module(mod_name='ansible_collections.vmware.vmware_rest.plugins.modules.vcenter_vm_power_info', init_globals=dict(_module_fqn='ansible_collections.vmware.vmware_rest.plugins.modules.vcenter_vm_power_info', _modlib_path=modlib_path),\n File \"/usr/lib/python3.10/runpy.py\", line 224, in run_module\n return _run_module_code(code, init_globals, run_name, mod_spec)\n File \"/usr/lib/python3.10/runpy.py\", line 96, in _run_module_code\n _run_code(code, mod_globals, init_globals,\n File \"/usr/lib/python3.10/runpy.py\", line 86, in _run_code\n exec(code, run_globals)\n File \"/tmp/ansible_vmware.vmware_rest.vcenter_vm_power_info_payload_x93q4i75/ansible_vmware.vmware_rest.vcenter_vm_power_info_payload.zip/ansible_collections/vmware/vmware_rest/plugins/modules/vcenter_vm_power_info.py\", line 232, in <module>\n File \"/usr/lib/python3.10/asyncio/base_events.py\", line 649, in run_until_complete\n return future.result()\n File \"/tmp/ansible_vmware.vmware_rest.vcenter_vm_power_info_payload_x93q4i75/ansible_vmware.vmware_rest.vcenter_vm_power_info_payload.zip/ansible_collections/vmware/vmware_rest/plugins/modules/vcenter_vm_power_info.py\", line 181, in main\n File \"/tmp/ansible_vmware.vmware_rest.vcenter_vm_power_info_payload_x93q4i75/ansible_vmware.vmware_rest.vcenter_vm_power_info_payload.zip/ansible_collections/cloud/common/plugins/module_utils/turbo/module.py\", line 120, in __init__\n File \"/tmp/ansible_vmware.vmware_rest.vcenter_vm_power_info_payload_x93q4i75/ansible_vmware.vmware_rest.vcenter_vm_power_info_payload.zip/ansible_collections/cloud/common/plugins/module_utils/turbo/module.py\", line 145, in run_on_daemon\n File \"/usr/lib/python3.10/contextlib.py\", line 135, in __enter__\n return next(self.gen)\n File \"/tmp/ansible_vmware.vmware_rest.vcenter_vm_power_info_payload_x93q4i75/ansible_vmware.vmware_rest.vcenter_vm_power_info_payload.zip/ansible_collections/cloud/common/plugins/module_utils/turbo/common.py\", line 132, in connect\n File \"/tmp/ansible_vmware.vmware_rest.vcenter_vm_power_info_payload_x93q4i75/ansible_vmware.vmware_rest.vcenter_vm_power_info_payload.zip/ansible_collections/cloud/common/plugins/module_utils/turbo/common.py\", line 54, in bind\nFileNotFoundError: [Errno 2] No such file or directory\n",
"module_stdout": "",
"msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
"rc": 1
}
SUMMARY
Cannot use
vmware.vmware_rest
. Using this plugin results in aFileNotFoundError: [Errno 2] No such file or directory
. I tried the hints provided in FileNotFoundError when running modules #262ISSUE TYPE
COMPONENT NAME
vmware.vmware_rest
ANSIBLE VERSION
COLLECTION VERSION
CONFIGURATION
OS / ENVIRONMENT
Fedora 37
Requirements:
STEPS TO REPRODUCE
Install vmware_rest:
Create playbook with the following task:
EXPECTED RESULTS
I would expect that it shows clsuter info.
ACTUAL RESULTS