theforeman.foreman.repository_set 模块 – 启用/禁用通过订阅获得的 Red Hat 仓库
注意
此模块是 theforeman.foreman 集合(版本 4.2.0)的一部分。
如果您正在使用 ansible
包,您可能已经安装了此集合。它不包含在 ansible-core
中。要检查是否已安装,请运行 ansible-galaxy collection list
。
要安装它,请使用:ansible-galaxy collection install theforeman.foreman
。您需要其他要求才能使用此模块,请参阅 要求 了解详细信息。
要在 playbook 中使用它,请指定:theforeman.foreman.repository_set
。
theforeman.foreman 1.0.0 中的新增功能
概要
启用/禁用通过订阅获得的 Red Hat 仓库
别名:katello_repository_set
要求
在执行此模块的主机上需要以下要求。
请求
参数
参数 |
注释 |
---|---|
影响仓库集中所有可用的仓库,而不是在 repositories 中列出它们。 当 repositories 未设置或为空列表时是必需的。 选项
|
|
仓库集的标签,可以代替 name & product 使用 |
|
仓库集的名称 |
|
实体所在的组织 |
|
访问 Foreman 服务器的用户的密码。 如果任务中未指定该值,则将使用环境变量 |
|
父产品的名称 |
|
要启用的仓库的版本和基本架构。 某些仓库集只需要设置 basearch 或 releasever。 请参阅示例,了解如何使用 theforeman.foreman.resource_info 获取此信息。 当 all_repositories 未设置或为 |
|
要启用的仓库的基本架构。 |
|
要启用的仓库的版本。 |
|
Foreman 服务器的 URL。 如果任务中未指定该值,则将使用环境变量 |
|
仓库是否启用 选项
|
|
访问 Foreman 服务器的用户名。 如果任务中未指定该值,则将使用环境变量 |
|
是否验证 Foreman 服务器的 TLS 证书。 如果任务中未指定该值,则将使用环境变量 选项
|
属性
属性 |
支持 |
描述 |
---|---|---|
支持:完整 |
可以在 check_mode 下运行,并返回已更改的状态预测,而无需修改实体 |
|
支持:完整 |
在差异模式下,将返回有关已更改(或可能需要在 check_mode 中更改)的详细信息 |
示例
- name: "Enable RHEL 7 RPMs repositories"
theforeman.foreman.repository_set:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: "Red Hat Enterprise Linux 7 Server (RPMs)"
organization: "Default Organization"
product: "Red Hat Enterprise Linux Server"
repositories:
- releasever: "7.0"
basearch: "x86_64"
- releasever: "7.1"
basearch: "x86_64"
- releasever: "7.2"
basearch: "x86_64"
- releasever: "7.3"
basearch: "x86_64"
state: enabled
- name: "Enable RHEL 7 RPMs repositories with label"
theforeman.foreman.repository_set:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
organization: "Default Organization"
label: rhel-7-server-rpms
repositories:
- releasever: "7.0"
basearch: "x86_64"
- releasever: "7.1"
basearch: "x86_64"
- releasever: "7.2"
basearch: "x86_64"
- releasever: "7.3"
basearch: "x86_64"
state: enabled
- name: "Disable RHEL 7 Extras RPMs repository"
theforeman.foreman.repository_set:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: Red Hat Enterprise Linux 7 Server - Extras (RPMs)
organization: "Default Organization"
product: Red Hat Enterprise Linux Server
state: disabled
repositories:
- basearch: x86_64
- name: "Enable RHEL 8 BaseOS RPMs repository with label"
theforeman.foreman.repository_set:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
organization: "Default Organization"
label: rhel-8-for-x86_64-baseos-rpms
repositories:
- releasever: "8"
- name: "Enable Red Hat Virtualization Manager RPMs repository with label"
theforeman.foreman.repository_set:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
organization: "Default Organization"
label: "rhel-7-server-rhv-4.2-manager-rpms"
repositories:
- basearch: x86_64
state: enabled
- name: "Enable Red Hat Virtualization Manager RPMs repository without specifying basearch"
theforeman.foreman.repository_set:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
organization: "Default Organization"
label: "rhel-7-server-rhv-4.2-manager-rpms"
all_repositories: true
state: enabled
- name: "Search for possible repository sets of a product"
theforeman.foreman.resource_info:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
organization: "Default Organization"
resource: repository_sets
search: product_name="Red Hat Virtualization Manager"
register: data
- name: "Output found repository sets, see the contentUrl section for possible repository substitutions"
debug:
var: data
- name: "Search for possible repository sets by label"
theforeman.foreman.resource_info:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
organization: "Default Organization"
resource: repository_sets
search: label=rhel-7-server-rhv-4.2-manager-rpms
register: data
- name: "Output found repository sets, see the contentUrl section for possible repository substitutions"
debug:
var: data
- name: Enable set with and without all_repositories at the same time
theforeman.foreman.repository_set:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
organization: "Default Organization"
label: "{{ item.label }}"
repositories: "{{ item.repositories | default(omit) }}"
all_repositories: "{{ item.repositories is not defined }}"
state: enabled
loop:
- label: rhel-7-server-rpms
repositories:
- releasever: "7Server"
basearch: "x86_64"
- label: rhel-7-server-rhv-4.2-manager-rpms
返回值
常见返回值记录在此处,以下是此模块独有的字段
键 |
描述 |
---|---|
受影响实体的最终状态,按其类型分组。 已返回:成功 |
|
仓库集列表。 已返回:成功 |