In this tutorial, How to fix run ansible “[Errno 32] Broken pipe\r\n”. I have enabled the EPEL repositories and installed the required dependencies for Python. How to Fix ansible python broken pipe.

Ansible python broken pipe running error as below
"changed": false,
"module_stderr": "",
"module_stdout": "Traceback (most recent call last):\r\n File \"/tmp/ansible-tmp-1546842879.5-134879756384147/setup.py\", line 133, in ?\r\n exitcode = invoke_module(module, zipped_mod, ANSIBALLZ_PARAMS)\r\n File \"/tmp/ansible-tmp-1546842879.5-134879756384147/setup.py\", line 38, in invoke_module\r\n (stdout, stderr) = p.communicate(json_params)\r\n File \"/usr/lib64/python2.4/subprocess.py\", line 1050, in communicate\r\n stdout, stderr = self._communicate_with_poll(input)\r\n File \"/usr/lib64/python2.4/subprocess.py\", line 1113, in _communicate_with_poll\r\n input_offset += os.write(fd, chunk)\r\nOSError: [Errno 32] Broken pipe\r\n",
"msg": "MODULE FAILURE",
"rc": 1
}
to retry, use: --limit @/nfs/playbooks/ansible-server/apache-server.retry
PLAY RECAP **********************************************************************************************************************************************************************************************************************************
webserver01 : ok=0 changed=0 unreachable=0 failed=1
My Ansible uses Python 2.6 and a remote server is a Virtual Machine OS Centos 5 use Python 2.4
After you installed Python 2.6 on the remote server ( Centos 5). Then configure in the PATH for Python 2.6
For example, In my configuration in PATH as below
$ echo $PATH
/usr/local/bin:/bin:/usr/bin
$ which python
/usr/bin/python
And configure symbolic link for Python 2.6 on the remote server Centos 5
$ ll /usr/bin/ | grep python
$ ln -sf /usr/bin/python26 /usr/local/bin/python
With that:
python 2.6 is in “/
usr /local/bin” *which is before “/usr /bin” in the PATHpython 2.4 is in “/
usr /bin“And both are in the PATH
And you running the ansible-playbook command again.
Conclusion
If the “broken pipe” error persists after trying these steps, it may indicate a more complex network issue or a problem specific to your environment.
Through the article, you can use Fixing ansible python broken pipe for RHEL Centos 5. I hope will this your helpful. For more details refer to Ansible tutorial.