去阿里云找国内源,再安装ansible就可以了
yum install -y https://mirrors.aliyun.com/epel/epel-release-latest-8.noarch.rpm
yum -y install ansible
但是我这个不行,提示缺少核心

本着能百度就不动脑的原则,百度了一圈后发现都不适用于我的情况
wget http://mirror.centos.org/centos/8-stream/AppStream/x86_64/os/Packages/ansible-core-2.12.7-1.el8.x86_64.rpm
rpm -ivh ansible-core-2.12.7-1.el8.x86_64.rpm
安装的时候回来看到缺少以下的配件

全部使用yum安装就是了,有些yum不动的可以在 点击这里去下载 找到对应的rpm包
当解决完核心的问题后,

dnf -y insall ansible

完成