ansible - 如何在 CentOS 8 上使用 Ansible 添加存储库

标签 ansible repository centos8 ansible-module

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

相关文章:

docker - 更改 docker 容器内的主机名时出错

ruby - 使用 ansible playbook 更改 rvm ruby​​ 版本

oracle - com.oracle :ojdbc6 in version 11. 2.0.3 有什么特别之处?

c# - 测试 Entity Framework 模型

centos - 屏幕分辨率 CentOS 8 - VMware

centos - 在 centOS 8 的 nmap 7.7 包中找不到 ndiff

ansible:使用变量指定目录路径

Ansible playbook 处理程序未通过通知语句启动服务

git - 从本地开始的集中式 Git 存储库

CentOS 8 Pane 已死 VMware Workstation 15.5