Issues with CentOS 8

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/
BUG_REPORT_URL=“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.

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/"
BUG_REPORT_URL="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]

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/.

To get the right tool via RPM, use this.

     sudo dnf remove ansible
     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.

!

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:~$

You need install python in CenOS.

sorry I re read, you need define python interpreter

https://docs.ansible.com/ansible/latest/reference_appendices/interpreter_discovery.html