在 CentOS 7 中,Ansible 具有 yum-repository
可用于添加存储库的模块。
在 CentOS 8 中存在 dnf
用于包管理的模块,但似乎没有 dnf-repository
添加存储库的模块。
你如何使用 Ansible 在 CentOS 8 上实现这一点?
最佳答案
正如你发现的,没有(还?...)dnf_repository
模块。同时,来自 Fedora system administration guide - Managing dnf repositories
To define a new repository, you can either add a
[repository]
section to the/etc/dnf/dnf.conf
file, or to a.repo
file in the/etc/yum.repos.d/
directory.
自
yum_repositories
module管理 /etc/yum.repos.d/
中的文件默认情况下,它应该是开箱即用的。正如
yum_repository
module documentation 中所述,最终要遵循的另一条轨道是使用 ini_file
module直接创建或修改您的存储库定义。
关于ansible - 如何在 CentOS 8 上使用 Ansible 添加存储库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62842753/