community.general.rhsm_repository 模块 – 使用 subscription-manager 命令管理 RHSM 仓库
注意
此模块是 community.general 集合 (版本 10.1.0) 的一部分。
如果您使用的是 ansible
包,则可能已安装此集合。它不包含在 ansible-core
中。要检查是否已安装,请运行 ansible-galaxy collection list
。
要安装它,请使用:ansible-galaxy collection install community.general
。您需要满足其他要求才能使用此模块,有关详细信息,请参阅 要求。
要在 playbook 中使用它,请指定:community.general.rhsm_repository
。
概要
使用
subscription-manager
命令管理 (启用/禁用) Red Hat 订阅管理授权平台的 RHSM 仓库。
要求
执行此模块的主机需要以下要求。
subscription-manager
参数
参数 |
注释 |
---|---|
要启用的仓库的 ID。 要操作多个仓库,这可以接受逗号分隔的列表或 YAML 列表。 |
|
如果 state 等于 present 或 disabled,则表示所需的仓库状态。 在 community.general 10.0.0 中,状态 选项
|
属性
属性 |
支持 |
描述 |
---|---|---|
支持:完全支持 |
可以在 |
|
支持:完全支持 |
在差异模式下,将返回有关已更改内容(或在 |
注释
注意
为了管理 RHSM 仓库,系统必须已经手动注册到 RHSM,或者使用 Ansible community.general.redhat_subscription 模块。
只有 root 用户才能与
subscription-manager
交互,因此需要 root 权限才能成功运行此模块。
示例
- name: Enable a RHSM repository
community.general.rhsm_repository:
name: rhel-7-server-rpms
- name: Disable all RHSM repositories
community.general.rhsm_repository:
name: '*'
state: disabled
- name: Enable all repositories starting with rhel-6-server
community.general.rhsm_repository:
name: rhel-6-server*
state: enabled
- name: Disable all repositories except rhel-7-server-rpms
community.general.rhsm_repository:
name: rhel-7-server-rpms
purge: true
返回值
常用的返回值已在 此处 记录,以下是此模块特有的字段
键 |
描述 |
---|---|
带有其状态的 RHSM 仓库列表。 当此模块用于更改仓库状态时,此列表包含更改后更新的状态。 返回:成功 |