# Issues with CentOS 8

**URL:** <https://forum.ansible.com/t/issues-with-centos-8/37497>\
**Category:** Ansible Project\
**Tags:** rhel, fedora, ubuntu\
**Created:** [December 24, 2022, 4:45pm UTC](https://forum.ansible.com/t/issues-with-centos-8/37497 "2022-12-24T16:45:09Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![tor\_eng](https://avatars.discourse-cdn.com/v4/letter/t/e56c9b/32.png) [@tor\_eng](https://forum.ansible.com/u/tor_eng)\
**Post date:** [December 24, 2022, 4:45pm UTC](https://forum.ansible.com/t/issues-with-centos-8/37497/1 "2022-12-24T16:45:09Z")

</div>

Hello all,  
I am new to ansible, trying to learn the basis so I can use it to automate some of my networking stuffs. I currently have setup a small lab with for Ubuntu and 2 CentOS systems. Anything I do on the Ubuntu works fine be the CentOS is always given me issues. I have pretty setup everything regarding connectivity but below is the error I get with one of the CentOS system when running an ad-hoc command to test ping.  
!  
_}_  
_10.18.13.17 | FAILED! =\> {_  
_“changed”: false,_  
_“module\_stderr”: “Shared connection to 10.18.13.17 closed.\r\n”,_  
_“module\_stdout”: “/bin/sh: /usr/bin/python: 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_  
_}_

This is the version of CentOS that I am running on the remote server  
!  
_NAME=“CentOS Stream”_  
_VERSION=“8”_  
_ID=“centos”_  
_ID\_LIKE=“rhel fedora”_  
_VERSION\_ID=“8”_  
_PLATFORM\_ID=“platform:el8”_  
_PRETTY\_NAME=“CentOS Stream 8”_  
_ANSI\_COLOR=“0;31”_  
_CPE\_NAME=“cpe:/o:centos:centos:8”_  
_HOME\_URL=“[https://centos.org/](https://centos.org/)”_  
_BUG\_REPORT\_URL=“[https://bugzilla.redhat.com/](https://bugzilla.redhat.com/)”_  
_REDHAT\_SUPPORT\_PRODUCT=“Red Hat Enterprise Linux 8”_  
_REDHAT\_SUPPORT\_PRODUCT\_VERSION=“CentOS Stream”_

_!_

This is also the version of ansible and python I am running on both remote server and ansible control host  
!  
**remote host**  
Python 3.6.8

**ansible-control-host**  
_ansible 2.7.7_  
_config file = /home/user/ansible\_training/ansible.cfg_  
_configured module search path = [‘/home/user/.ansible/plugins/modules’, ‘/usr/share/ansible/plugins/modules’]_  
_ansible python module location = /usr/lib/python3/dist-packages/ansible_  
_executable location = /usr/bin/ansible_  
_python version = 3.7.3 (default, Oct 31 2022, 14:04:00) [GCC 8.3.0]_

!  
Can anybody help me with this error ?  
Thank you.

---

<div class="post-metadata">

**Author:** ![Nico\_Kadel-Garcia](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/nico_kadel-garcia/32/9998_2.png) [@Nico\_Kadel-Garcia](https://forum.ansible.com/u/Nico_Kadel-Garcia)\
**Post date:** [December 24, 2022, 6:23pm UTC](https://forum.ansible.com/t/issues-with-centos-8/37497/2 "2022-12-24T18:23:07Z")

</div>

> Hello all,  
> &nbsp;&nbsp;&nbsp;&nbsp;I am new to ansible, trying to learn the basis so I can use it to automate some of my networking stuffs. I currently have setup a small lab with for Ubuntu and 2 CentOS systems. Anything I do on the Ubuntu works fine be the CentOS is always given me issues. I have pretty setup everything regarding connectivity but below is the error I get with one of the CentOS system when running an ad-hoc command to test ping.  
> !  
> }  
> 10.18.13.17 | FAILED! =\> {  
> &nbsp;&nbsp;&nbsp;&nbsp;"changed": false,  
> &nbsp;&nbsp;&nbsp;&nbsp;"module\_stderr": "Shared connection to 10.18.13.17 closed.\r\n",  
> &nbsp;&nbsp;&nbsp;&nbsp;"module\_stdout": "/bin/sh: /usr/bin/python: No such file or directory\r\n",  
> &nbsp;&nbsp;&nbsp;&nbsp;"msg": "The module failed to execute correctly, you probably need to set the interpreter.\nSee stdout/stderr for the exact error",  
> &nbsp;&nbsp;&nbsp;&nbsp;"rc": 127  
> }
> 
> This is the version of CentOS that I am running on the remote server  
> !  
> NAME="CentOS Stream"  
> VERSION="8"  
> ID="centos"  
> ID\_LIKE="rhel fedora"  
> VERSION\_ID="8"  
> PLATFORM\_ID="platform:el8"  
> PRETTY\_NAME="CentOS Stream 8"  
> ANSI\_COLOR="0;31"  
> CPE\_NAME="cpe:/o:centos:centos:8"  
> HOME\_URL="[https://centos.org/&quot](https://centos.org/&quot);  
> BUG\_REPORT\_URL="[https://bugzilla.redhat.com/&quot](https://bugzilla.redhat.com/&quot);  
> REDHAT\_SUPPORT\_PRODUCT="Red Hat Enterprise Linux 8"  
> REDHAT\_SUPPORT\_PRODUCT\_VERSION="CentOS Stream"  
> !
> 
> This is also the version of ansible and python I am running on both remote server and ansible control host  
> !  
> remote host  
> Python 3.6.8
> 
> ansible-control-host  
> ansible 2.7.7  
> &nbsp;&nbsp;config file = /home/user/ansible\_training/ansible.cfg  
> &nbsp;&nbsp;configured module search path = ['/home/user/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']  
> &nbsp;&nbsp;ansible python module location = /usr/lib/python3/dist-packages/ansible  
> &nbsp;&nbsp;executable location = /usr/bin/ansible  
> &nbsp;&nbsp;python version = 3.7.3 (default, Oct 31 2022, 14:04:00) [GCC 8.3.0]

Stop right there. That "ansible" is from well before it was split to  
ansible-core, which has the ansible scripts and binaries, and is now  
up to version 2.13 in RPMs available for RHEL and CentOS 8. And the  
"ansible" package, itself, is no longer ansible. It's a collection of  
more than 100 "ansible\_collections" modules, in a tarball called  
"ansible", and yes it is amazingly confusing.

Don't install the "ansible" package anymore on RHEL. There is no  
official RPM published for it from Red Hat, there is only the  
"ansible-core" package. The only one who publishes a workable RPM, or  
RPM building tools for it on RHEL, is me over at  
[https://github.com/nkadel/ansiblerepo/](https://github.com/nkadel/ansiblerepo/).

To get the right tool via RPM, use this.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sudo dnf remove ansible  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sudo dnf install ansible-core

This should help. The split of python to "python2" and "python3"  
caused a lot of confusion, and I'm afraid that older versions of  
ansible are not as consistent about using "python3" by default.

!

---

<div class="post-metadata">

**Author:** ![tor\_eng](https://avatars.discourse-cdn.com/v4/letter/t/e56c9b/32.png) [@tor\_eng](https://forum.ansible.com/u/tor_eng)\
**Post date:** [December 24, 2022, 9:06pm UTC](https://forum.ansible.com/t/issues-with-centos-8/37497/3 "2022-12-24T21:06:56Z")

</div>

Thank you nkadel for your response but I am running the ansible on ubuntu mate not the CentOS. I tried removing ansible from the ubuntu host and re-installing it like you said but I got an error message. Please see below  
!  
_user@ansible-controller:~$ sudo apt install ansible-core -y_  
_Reading package lists… Done_  
_Building dependency tree_  
_Reading state information… Done_  
_ **E: Unable to locate package ansible-core** _  
_user@ansible-controller:~$_

---

<div class="post-metadata">

**Author:** ![OSiUX](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/osiux/32/263_2.png) [@OSiUX](https://forum.ansible.com/u/OSiUX)\
**Post date:** [December 25, 2022, 6:10pm UTC](https://forum.ansible.com/t/issues-with-centos-8/37497/4 "2022-12-25T18:10:04Z")

</div>

You need install python in CenOS.

---

<div class="post-metadata">

**Author:** ![OSiUX](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/osiux/32/263_2.png) [@OSiUX](https://forum.ansible.com/u/OSiUX)\
**Post date:** [December 25, 2022, 6:18pm UTC](https://forum.ansible.com/t/issues-with-centos-8/37497/5 "2022-12-25T18:18:58Z")

</div>

sorry I re read, you need define python interpreter

[https://docs.ansible.com/ansible/latest/reference\_appendices/interpreter\_discovery.html](https://docs.ansible.com/ansible/latest/reference_appendices/interpreter_discovery.html)
