ansible-collections / vmware.vmware_rest

Ansible Collection for VMWare (REST modules)
https://ansible-collections.github.io/vmware.vmware_rest/
GNU General Public License v3.0
132 stars 64 forks source link

FileNotFoundError: [Errno 2] No such file or directory #411

Open pandalec opened 1 year ago

pandalec commented 1 year ago
SUMMARY

Cannot use vmware.vmware_rest. Using this plugin results in a FileNotFoundError: [Errno 2] No such file or directory. I tried the hints provided in FileNotFoundError when running modules #262

ISSUE TYPE
COMPONENT NAME

vmware.vmware_rest

ANSIBLE VERSION
ansible [core 2.14.4]
  config file = /home/panda/.ansible.cfg
  configured module search path = ['/home/panda/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/panda/Git/project/venv/lib64/python3.11/site-packages/ansible
  ansible collection location = /home/panda/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/panda/Git/project/venv/bin/ansible
  python version = 3.11.2 (main, Feb  8 2023, 00:00:00) [GCC 12.2.1 20221121 (Red Hat 12.2.1-4)] (/home/panda/Git/project/venv/bin/python3)
  jinja version = 3.1.2
  libyaml = True
COLLECTION VERSION
# /home/panda/Git/project/venv/lib64/python3.11/site-packages/ansible_collections
Collection        Version
----------------- -------
community.general 6.5.0  

# /home/panda/Git/project/venv/lib/python3.11/site-packages/ansible_collections
Collection        Version
----------------- -------
community.general 6.5.0
CONFIGURATION
CALLBACKS_ENABLED(/home/panda/.ansible.cfg) = ['profile_tasks']
CONFIG_FILE() = /home/panda/.ansible.cfg
HOST_KEY_CHECKING(/home/panda/.ansible.cfg) = False
OS / ENVIRONMENT

Fedora 37

Requirements:

wheel
ansible
pyvmomi<=v7.0.2
aiohttp
ansible-lint
pylint
autopep8
lxml
git+https://github.com/vmware/vsphere-automation-sdk-python.git
pyVim
STEPS TO REPRODUCE

Install vmware_rest:

ansible-galaxy collection install vmware.vmware_rest

Create playbook with the following task:

    - name: Look up the Cluster in the inventory
      register: search_result
      vmware.vmware_rest.vcenter_cluster_info:
        cluster: "Cluster"
      delegate_to: localhost
EXPECTED RESULTS

I would expect that it shows clsuter info.

ACTUAL RESULTS
The full traceback is:
Traceback (most recent call last):
  File "/home/panda/.ansible/tmp/ansible-tmp-1681997493.1066985-330989-221743039289391/AnsiballZ_vcenter_cluster_info.py", line 107, in <module>
    _ansiballz_main()
  File "/home/panda/.ansible/tmp/ansible-tmp-1681997493.1066985-330989-221743039289391/AnsiballZ_vcenter_cluster_info.py", line 99, in _ansiballz_main
    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
  File "/home/panda/.ansible/tmp/ansible-tmp-1681997493.1066985-330989-221743039289391/AnsiballZ_vcenter_cluster_info.py", line 47, in invoke_module
    runpy.run_module(mod_name='ansible_collections.vmware.vmware_rest.plugins.modules.vcenter_cluster_info', init_globals=dict(_module_fqn='ansible_collections.vmware.vmware_rest.plugins.modules.vcenter_cluster_info', _modlib_path=modlib_path),
  File "<frozen runpy>", line 226, in run_module
  File "<frozen runpy>", line 98, in _run_module_code
  File "<frozen runpy>", line 88, in _run_code
  File "/tmp/ansible_vmware.vmware_rest.vcenter_cluster_info_payload_mvbpv8h4/ansible_vmware.vmware_rest.vcenter_cluster_info_payload.zip/ansible_collections/vmware/vmware_rest/plugins/modules/vcenter_cluster_info.py", line 305, in <module>
  File "/usr/lib64/python3.11/asyncio/base_events.py", line 653, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/tmp/ansible_vmware.vmware_rest.vcenter_cluster_info_payload_mvbpv8h4/ansible_vmware.vmware_rest.vcenter_cluster_info_payload.zip/ansible_collections/vmware/vmware_rest/plugins/modules/vcenter_cluster_info.py", line 234, in main
  File "/tmp/ansible_vmware.vmware_rest.vcenter_cluster_info_payload_mvbpv8h4/ansible_vmware.vmware_rest.vcenter_cluster_info_payload.zip/ansible_collections/cloud/common/plugins/module_utils/turbo/module.py", line 119, in __init__
  File "/tmp/ansible_vmware.vmware_rest.vcenter_cluster_info_payload_mvbpv8h4/ansible_vmware.vmware_rest.vcenter_cluster_info_payload.zip/ansible_collections/cloud/common/plugins/module_utils/turbo/module.py", line 143, in run_on_daemon
  File "/usr/lib64/python3.11/contextlib.py", line 137, in __enter__
    return next(self.gen)
           ^^^^^^^^^^^^^^
  File "/tmp/ansible_vmware.vmware_rest.vcenter_cluster_info_payload_mvbpv8h4/ansible_vmware.vmware_rest.vcenter_cluster_info_payload.zip/ansible_collections/cloud/common/plugins/module_utils/turbo/common.py", line 122, in connect
  File "/tmp/ansible_vmware.vmware_rest.vcenter_cluster_info_payload_mvbpv8h4/ansible_vmware.vmware_rest.vcenter_cluster_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: [dev-14-repository -> localhost]: FAILED! => {
    "changed": false,
    "module_stderr": "Traceback (most recent call last):\n  File \"/home/panda/.ansible/tmp/ansible-tmp-1681997493.1066985-330989-221743039289391/AnsiballZ_vcenter_cluster_info.py\", line 107, in <module>\n    _ansiballz_main()\n  File \"/home/panda/.ansible/tmp/ansible-tmp-1681997493.1066985-330989-221743039289391/AnsiballZ_vcenter_cluster_info.py\", line 99, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/home/panda/.ansible/tmp/ansible-tmp-1681997493.1066985-330989-221743039289391/AnsiballZ_vcenter_cluster_info.py\", line 47, in invoke_module\n    runpy.run_module(mod_name='ansible_collections.vmware.vmware_rest.plugins.modules.vcenter_cluster_info', init_globals=dict(_module_fqn='ansible_collections.vmware.vmware_rest.plugins.modules.vcenter_cluster_info', _modlib_path=modlib_path),\n  File \"<frozen runpy>\", line 226, in run_module\n  File \"<frozen runpy>\", line 98, in _run_module_code\n  File \"<frozen runpy>\", line 88, in _run_code\n  File \"/tmp/ansible_vmware.vmware_rest.vcenter_cluster_info_payload_mvbpv8h4/ansible_vmware.vmware_rest.vcenter_cluster_info_payload.zip/ansible_collections/vmware/vmware_rest/plugins/modules/vcenter_cluster_info.py\", line 305, in <module>\n  File \"/usr/lib64/python3.11/asyncio/base_events.py\", line 653, in run_until_complete\n    return future.result()\n           ^^^^^^^^^^^^^^^\n  File \"/tmp/ansible_vmware.vmware_rest.vcenter_cluster_info_payload_mvbpv8h4/ansible_vmware.vmware_rest.vcenter_cluster_info_payload.zip/ansible_collections/vmware/vmware_rest/plugins/modules/vcenter_cluster_info.py\", line 234, in main\n  File \"/tmp/ansible_vmware.vmware_rest.vcenter_cluster_info_payload_mvbpv8h4/ansible_vmware.vmware_rest.vcenter_cluster_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_cluster_info_payload_mvbpv8h4/ansible_vmware.vmware_rest.vcenter_cluster_info_payload.zip/ansible_collections/cloud/common/plugins/module_utils/turbo/module.py\", line 143, in run_on_daemon\n  File \"/usr/lib64/python3.11/contextlib.py\", line 137, in __enter__\n    return next(self.gen)\n           ^^^^^^^^^^^^^^\n  File \"/tmp/ansible_vmware.vmware_rest.vcenter_cluster_info_payload_mvbpv8h4/ansible_vmware.vmware_rest.vcenter_cluster_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_cluster_info_payload_mvbpv8h4/ansible_vmware.vmware_rest.vcenter_cluster_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
}
cbreuil-orange commented 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'
idontevenreallycare commented 1 year ago

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 \r _ansiballz_main()\r File "/home/ansible/.ansible/tmp/ansible-tmp-1683301646.3150833-99-269542372869278/AnsiballZ_vcenter_vm_power.py", line 99, in _ansiballz_main\r invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\r File "/home/ansible/.ansible/tmp/ansible-tmp-1683301646.3150833-99-269542372869278/AnsiballZ_vcenter_vm_power.py", line 48, in invoke_module\r run_name='main', alter_sys=True)\r File "/usr/lib64/python3.6/runpy.py", line 205, in run_module\r return _run_module_code(code, init_globals, run_name, mod_spec)\r File "/usr/lib64/python3.6/runpy.py", line 96, in _run_module_code\r mod_name, mod_spec, pkg_name, script_name)\r File "/usr/lib64/python3.6/runpy.py", line 85, in _run_code\r exec(code, run_globals)\r File "/tmp/ansible_vmware.vmware_rest.vcenter_vm_power_payload_x0qy8xte/ansible_vmware.vmware_rest.vcenter_vm_power_payload.zip/ansible_collections/vmware/vmware_rest/plugins/modules/vcenter_vm_power.py", line 527, in \r File "/usr/lib64/python3.6/asyncio/base_events.py", line 484, in run_until_complete\r return future.result()\r File "/tmp/ansible_vmware.vmware_rest.vcenter_vm_power_payload_x0qy8xte/ansible_vmware.vmware_rest.vcenter_vm_power_payload.zip/ansible_collections/vmware/vmware_rest/plugins/modules/vcenter_vm_power.py", line 379, in main\r File "/tmp/ansible_vmware.vmware_rest.vcenter_vm_power_payload_x0qy8xte/ansible_vmware.vmware_rest.vcenter_vm_power_payload.zip/ansible_collections/cloud/common/plugins/module_utils/turbo/module.py", line 119, in init\r File "/tmp/ansible_vmware.vmware_rest.vcenter_vm_power_payload_x0qy8xte/ansible_vmware.vmware_rest.vcenter_vm_power_payload.zip/ansible_collections/cloud/common/plugins/module_utils/turbo/module.py", line 144, in run_on_daemon\r File "/usr/lib64/python3.6/contextlib.py", line 81, in enter\r return next(self.gen)\r File "/tmp/ansible_vmware.vmware_rest.vcenter_vm_power_payload_x0qy8xte/ansible_vmware.vmware_rest.vcenter_vm_power_payload.zip/ansible_collections/cloud/common/plugins/module_utils/turbo/common.py", line 122, in connect\r File "/tmp/ansible_vmware.vmware_rest.vcenter_vm_power_payload_x0qy8xte/ansible_vmware.vmware_rest.vcenter_vm_power_payload.zip/ansible_collections/cloud/common/plugins/module_utils/turbo/common.py", line 54, in bind\r FileNotFoundError: [Errno 2] No such file or directory\r

abikouo commented 1 year ago

@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

kastakhov commented 10 months ago

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.

abikouo commented 10 months ago

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 ?)?

kastakhov commented 10 months ago

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
}