Error AnsiballZ_setup.py line 27

Hi,
I am getting following error even though I have python 2.7.18 in my host system.Can someone help me to resolve the issue?

LAY [label_ansible_yes] *********************************************************************************************************************************************************************

PLAY [label_ansible_role_trafgen] ************************************************************************************************************************************************************

TASK [Gathering Facts] ***********************************************************************************************************************************************************************
Friday 29 October 2021 12:22:28 +0200 (0:00:00.151) 0:00:00.151 ********
fatal: [enl-trafgen-0_enl-trafgen]: FAILED! => {“ansible_facts”: {}, “changed”: false, “failed_modules”: {“setup”: {“ansible_facts”: {“discovered_interpreter_python”: “/usr/bin/python”}, “failed”: true, “module_stderr”: " File "/tmp/ansible-tmp-1635502948.8-187514138802855/AnsiballZ_setup.py", line 27\n ZIPDATA = """UEsDBBQAAAAIAM5iXVOdxfFrNwAAAEgAAAAgAAAAYW5zaWJsZS9tb2R1bGVfdXRpbHMvX19pbml0X18ucHlLK8rPVSjITi8tycxRyMwtyC8qUUitKEnNS4kvSCzJ4IoHU/


+Y1tf3nHdUDq50GQuBVB5B6LdHUrZ9AlWHPhMpaHjGW3iX5quUucM6RDgPeea6aL3srz1fzozdmgq23uFs4pI7tafRrHPMVPN3Lgisuwid84aeV4eonwrTaCuszPeyaJCfmcIoeGgNhggqZ4VF8JL3JYDhqQzAp6aF3ThKgee7wFgB2ahMnblafSrUqOX19qlG\n ^\nSyntaxError: EOF while scanning triple-quoted string literal\ncommand terminated with exit code 1\n", “module_stdout”: “”, “msg”: “MODULE FAILURE\nSee stdout/stderr for the exact error”, “rc”: 1, “warnings”: [“Platform linux on host enl-trafgen-0_enl-trafgen is using the discovered Python interpreter at /usr/bin/python, but future installation of another Python interpreter could change this. See https://docs.ansible.com/ansible/2.9/reference_appendices/interpreter_discovery.html for more information.”]}}, “msg”: “The following modules failed to execute: setup\n”}

PLAY RECAP ***********************************************************************************************************************************************************************************
enl-trafgen-0_enl-trafgen : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0

Friday 29 October 2021 12:22:31 +0200 (0:00:02.637) 0:00:02.789 ********

Can some one help me resolve this issue? I tired with having similar python 2.7.18 on host, target vm and pod. but still the problem persists.

use -vvv and make sure the 'setup' being picked up for execution is
the Ansible one, this seems like an issue of having another setup.py
in your PYTHONPATH that is obscuring the Ansible one.

Hi Brian,

Thanks for the hint. With -vvvvv option I found that the file copy AnsiballZ_setup.py from host to target pod got corrupted.
It copied half of the file where the the file has triple quotes.

I see that ansible uses PUT (curl?) to copy the files to target pods:
<enl-trafgen-0_enl-trafgen> PUT /home/ejagpat/.ansible/tmp/ansible-local-5870YgWwiY/tmpeayo3R TO /tmp/ansible-tmp-1636022875.82-192503508326341/AnsiballZ_setup.py

Is there alternative to this method? what is the problem then?

Thanks for help,
Jagannath

the method used depends on the connection plugin you are using and
that should be visible in the -vvv output, PUT is just 'the action
done' not really that it is using an http method (winrm does, but most
others do not). Afaik there are no plugins that use curl. If using
ssh, you can configure the method sftp, scp or dd over the ssh pipe.

Hi Brian,

I found that ansible do not use SSH to communicate with k8s PODS. Hence those option sftp/scp/dd are not valid.
The AnsiballZ_setup.py file is constructed by ansible and sent to pod using kubectl api-server APIs.
So, this file is copied half.

I am running out of ideas to debug it further :frowning:

Thanks,
Jagannath

Open a bug report on the connection plugin you are using.

Hi Brian,

Well till no many experiments failed from my side.
Where I should raise a bug? Could you please provide the link?

Thanks,
Jagannath