community.general.dnf_config_manager 模块 – 使用 config-manager 启用或禁用 dnf 仓库
注意
此模块是 community.general 集合 (版本 10.1.0) 的一部分。
如果您使用的是 ansible
包,您可能已经安装了此集合。它不包含在 ansible-core
中。要检查是否已安装,请运行 ansible-galaxy collection list
。
要安装它,请使用:ansible-galaxy collection install community.general
。您需要其他要求才能使用此模块,请参阅 要求 了解详细信息。
要在 playbook 中使用它,请指定:community.general.dnf_config_manager
。
community.general 8.2.0 中的新功能
概要
此模块使用
dnf config-manager
子命令启用或禁用仓库。
要求
以下是在执行此模块的主机上所需的要求。
dnf
dnf-plugins-core
参数
参数 |
注释 |
---|---|
仓库 ID,例如 默认值: |
|
仓库应为 选项
|
属性
属性 |
支持 |
描述 |
---|---|---|
支持: 完整 |
可以在 |
|
支持: 无 |
在 diff 模式下,将返回已更改的内容的详细信息(或者在 |
另请参阅
另请参阅
- ansible.builtin.dnf
使用 dnf 包管理器管理软件包。
- ansible.builtin.yum_repository
添加或删除 YUM 仓库。
示例
- name: Ensure the crb repository is enabled
community.general.dnf_config_manager:
name: crb
state: enabled
- name: Ensure the appstream and zfs repositories are disabled
community.general.dnf_config_manager:
name:
- appstream
- zfs
state: disabled
返回值
常见返回值记录在 此处,以下是此模块特有的字段
键 |
描述 |
---|---|
已更改的仓库。 返回:成功 示例: |
|
执行操作后仓库的状态。 返回:成功 示例: |
|
已禁用的仓库 ID。 返回:成功 |
|
已启用的仓库 ID。 返回:成功 |
|
执行操作之前仓库的 ID。 返回:成功 示例: |
|
已禁用的仓库 ID。 返回:成功 |
|
已启用的仓库 ID。 返回:成功 |