Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$HOME/.pyvirt/bin/python3.11: No such file or directory ... The following modules failed to execute: ansible.legacy.setup #363

Closed
cmoulliard opened this issue Dec 1, 2023 · 4 comments · Fixed by #356

Comments

@cmoulliard
Copy link
Member

Issue

Still no luck to create a VM using the playbook.

pass-team
source ~/.pyvirt/bin/activate
(.pyvirt)  ✘  ~/code/snowdrop/k8s-infra   pr-356  ansible-playbook ansible/playbook/openstack/openstack_vm_create_passwordstore.yml -e '{"openstack": {"vm": {"network": "provider_net_shared","image": "Fedora-Cloud-Base-37", "flavor": "ci.m4.xlarge"}}}' -e vm_name=charles-vm
...
TASK [Gathering Facts] *******************************************************************************************************************************************************************************************************
fatal: [charles-vm]: FAILED! => {"ansible_facts": {}, "changed": false, "failed_modules": {"ansible.legacy.setup": {"failed": true, "module_stderr": "Shared connection to 10.0.77.131 closed.\r\n", "module_stdout": "/bin/sh: line 1: /Users/cmoullia/.pyvirt/bin/python3.11: No such file or directory\r\n", "msg": "The module failed to execute correctly, you probably need to set the interpreter.\nSee stdout/stderr for the exact error", "rc": 127}}, "msg": "The following modules failed to execute: ansible.legacy.setup\n"}

PLAY RECAP *******************************************************************************************************************************************************************************************************************
charles-vm                 : ok=2    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0
localhost                  : ok=43   changed=6    unreachable=0    failed=0    skipped=14   rescued=0    ignored=0
@cmoulliard
Copy link
Member Author

I ran again the command and vm has been created. I can ssh even if the playbook is still running/waiting ....

TASK [snowdrop.cloud_infra.openstack_vm : Create VM instance] ****************************************************************************************************************************************************************
task path: /Users/cmoullia/.ansible/collections/ansible_collections/snowdrop/cloud_infra/roles/openstack_vm/tasks/vm_create.yml:67
<127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: cmoullia
<127.0.0.1> EXEC /bin/sh -c 'echo ~cmoullia && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /Users/cmoullia/.ansible/tmp `"&& mkdir "` echo /Users/cmoullia/.ansible/tmp/ansible-tmp-1701419632.3215659-13254-3921258540975 `" && echo ansible-tmp-1701419632.3215659-13254-3921258540975="` echo /Users/cmoullia/.ansible/tmp/ansible-tmp-1701419632.3215659-13254-3921258540975 `" ) && sleep 0'
Using module file /Users/cmoullia/.ansible/collections/ansible_collections/openstack/cloud/plugins/modules/server.py
<127.0.0.1> PUT /Users/cmoullia/.ansible/tmp/ansible-local-1126686fh7uml/tmpi02lpf3r TO /Users/cmoullia/.ansible/tmp/ansible-tmp-1701419632.3215659-13254-3921258540975/AnsiballZ_server.py
<127.0.0.1> EXEC /bin/sh -c 'chmod u+x /Users/cmoullia/.ansible/tmp/ansible-tmp-1701419632.3215659-13254-3921258540975/ /Users/cmoullia/.ansible/tmp/ansible-tmp-1701419632.3215659-13254-3921258540975/AnsiballZ_server.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '/Users/cmoullia/.pyvirt/bin/python /Users/cmoullia/.ansible/tmp/ansible-tmp-1701419632.3215659-13254-3921258540975/AnsiballZ_server.py && sleep 0'

NOTE: Floating_IP is not saved as I got such a wazrning message

passstore-vm-ssh.sh openstack charles-vm
Error: openstack/charles-vm/floating_ip is not in the password store.
### SSH COMMAND: ssh -i /Users/cmoullia/.ssh/id_rsa_snowdrop_openstack snowdrop@10.0.77.131 -p 22
Last login: Fri Dec  1 08:48:28 2023 from 10.39.193.161
[snowdrop@charles-vm ~]$

@cmoulliard
Copy link
Member Author

According to the discussion on slack, the problem is related to

so as sivel mentioned, your issue is that you are setting the interpreter for the remote to match the local one, hence the error of not finding it. You just need to find where you set ansible_python_interpreter

@jacobdotcosta

@cmoulliard
Copy link
Member Author

Could the problem be what we set here:

ansible_python_interpreter=/usr/bin/python3
@jacobdotcosta

@cmoulliard
Copy link
Member Author

Does that help what I collected here using a more verbose mode ?

TASK [Store optional Host information on passwordstore] ************************
...
TASK [Refresh the inventory so the newly added host is available] **************
...
TASK [Wait for connection to host] *********************************************
task path: /Users/cmoullia/code/snowdrop/k8s-infra/ansible/playbook/openstack/openstack_vm_create_passwordstore.yml:84
redirecting (type: lookup) ansible.builtin.passwordstore to community.general.passwordstore
Loading collection community.general from /Users/cmoullia/.pyvirt/lib/python3.11/site-packages/ansible_collections/community/general
redirecting (type: lookup) ansible.builtin.passwordstore to community.general.passwordstore
<10.0.76.28> ESTABLISH LOCAL CONNECTION FOR USER: cmoullia
<10.0.76.28> EXEC /bin/sh -c 'echo ~cmoullia && sleep 0'
<10.0.76.28> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /Users/cmoullia/.ansible/tmp `"&& mkdir "` echo /Users/cmoullia/.ansible/tmp/ansible-tmp-1701937981.608011-62757-26170930869139 `" && echo ansible-tmp-1701937981.608011-62757-26170930869139="` echo /Users/cmoullia/.ansible/tmp/ansible-tmp-1701937981.608011-62757-26170930869139 `" ) && sleep 0'
<macos-test> Attempting python interpreter discovery
<10.0.76.28> EXEC /bin/sh -c 'echo PLATFORM; uname; echo FOUND; command -v '"'"'python3.11'"'"'; command -v '"'"'python3.10'"'"'; command -v '"'"'python3.9'"'"'; command -v '"'"'python3.8'"'"'; command -v '"'"'python3.7'"'"'; command -v '"'"'python3.6'"'"'; command -v '"'"'python3.5'"'"'; command -v '"'"'/usr/bin/python3'"'"'; command -v '"'"'/usr/libexec/platform-python'"'"'; command -v '"'"'python2.7'"'"'; command -v '"'"'/usr/bin/python'"'"'; command -v '"'"'python'"'"'; echo ENDFOUND && sleep 0'
<macos-test> Python interpreter discovery fallback (unsupported platform for extended discovery: darwin)
Using module file /Users/cmoullia/.pyvirt/lib/python3.11/site-packages/ansible/modules/wait_for.py
<10.0.76.28> PUT /Users/cmoullia/.ansible/tmp/ansible-local-590139v0wkebt/tmpebdzjwmi TO /Users/cmoullia/.ansible/tmp/ansible-tmp-1701937981.608011-62757-26170930869139/AnsiballZ_wait_for.py
<10.0.76.28> EXEC /bin/sh -c 'chmod u+x /Users/cmoullia/.ansible/tmp/ansible-tmp-1701937981.608011-62757-26170930869139/ /Users/cmoullia/.ansible/tmp/ansible-tmp-1701937981.608011-62757-26170930869139/AnsiballZ_wait_for.py && sleep 0'
<10.0.76.28> EXEC /bin/sh -c '/Users/cmoullia/.pyvirt/bin/python3.11 /Users/cmoullia/.ansible/tmp/ansible-tmp-1701937981.608011-62757-26170930869139/AnsiballZ_wait_for.py && sleep 0'
<10.0.76.28> EXEC /bin/sh -c 'rm -f -r /Users/cmoullia/.ansible/tmp/ansible-tmp-1701937981.608011-62757-26170930869139/ > /dev/null 2>&1 && sleep 0'
ok: [macos-test] => {
    "ansible_facts": {
        "discovered_interpreter_python": "/Users/cmoullia/.pyvirt/bin/python3.11"
    },
    "changed": false,
    "elapsed": 0,
    "invocation": {
        "module_args": {
            "active_connection_states": [
                "ESTABLISHED",
                "FIN_WAIT1",
                "FIN_WAIT2",
                "SYN_RECV",
                "SYN_SENT",
                "TIME_WAIT"
            ],
            "connect_timeout": 5,
            "delay": 0,
            "exclude_hosts": null,
            "host": "10.0.76.28",
            "msg": null,
            "path": null,
            "port": 22,
            "search_regex": null,
            "sleep": 1,
            "state": "started",
            "timeout": 120
        }
...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants