theforeman.foreman.repository 模块 – 管理仓库

注意

此模块是 theforeman.foreman 集合 (版本 4.2.0) 的一部分。

如果您使用的是 ansible 包,则可能已经安装了此集合。它不包含在 ansible-core 中。要检查它是否已安装,请运行 ansible-galaxy collection list

要安装它,请使用:ansible-galaxy collection install theforeman.foreman。您需要其他要求才能使用此模块,请参阅 要求 获取详细信息。

要在 playbook 中使用它,请指定:theforeman.foreman.repository

theforeman.foreman 1.0.0 中的新增功能

概要

  • 创建和管理仓库

别名:katello_repository

要求

以下要求是在执行此模块的主机上所需的。

  • requests

参数

参数

注释

ansible_collection_requirements

字符串

要从 URL 同步的需求 yaml 文件的内容

arch

字符串

仓库中内容的架构

设置为 noarch 以再次禁用架构限制。

auto_enabled

布尔值

仓库将在订阅此产品的已注册主机上自动启用

选项

  • false

  • true

checksum_type

字符串

仓库的校验和

选项

  • "sha1"

  • "sha256"

content_type

字符串 / 必需

仓库的内容类型

选项

  • "deb"

  • "docker"

  • "file"

  • "ostree"

  • "puppet"

  • "yum"

  • "ansible_collection"

deb_architectures

字符串

要从 deb-archive 同步的架构的逗号分隔列表

仅适用于 *content_type=deb*

deb_components

字符串

要从 deb-archive 同步的仓库组件的逗号分隔列表

仅适用于 *content_type=deb*

deb_errata_url

字符串

从中同步 Debian 或 Ubuntu 勘误信息的 URL

仅在 Orcharhino 上可用

仅适用于 *content_type=deb*

deb_releases

字符串

要从 deb-archive 同步的发行版的逗号分隔列表

仅适用于 *content_type=deb*

description

字符串

仓库的描述

docker_tags_whitelist

列表 / 元素=字符串

要为容器镜像仓库同步的标签列表

仅适用于 *content_type=docker*

自 Katello 4.4 起已弃用

docker_upstream_name

字符串

上游 docker 仓库的名称

仅适用于 *content_type=docker*

download_concurrency

整数

在 theforeman.foreman 3.0.0 中添加

从上游同步的下载并发性

由于 API 没有返回此值,这将破坏此模块的幂等性

download_policy

字符串

从上游同步的下载策略。

下载策略 background 已弃用,自 Katello 4.3 起不可用。

选项

  • "background"

  • "immediate"

  • "on_demand"

exclude_tags

列表 / 元素=字符串

在 theforeman.foreman 3.7.0 中添加

同步容器镜像仓库时要排除的标签列表。

gpg_key

字符串

仓库 GPG 密钥

http_proxy

字符串

要用于内容同步的 http 代理的名称

应与 *http_proxy_policy='use_selected_http_proxy'* 结合使用

http_proxy_policy

字符串

要用于内容同步的代理

选项

  • "global_default_http_proxy"

  • "none"

  • "use_selected_http_proxy"

ignorable_content

列表 / 元素=字符串

同步 yum 仓库时要忽略的内容单元列表。

必须是 rpm、drpm、srpm、distribution、erratum 的子集。

ignore_global_proxy

布尔值

内容同步是否应使用或忽略全局 http 代理设置

此功能在 Katello 3.13 中已弃用

它已被 *http_proxy_policy* 取代

选项

  • false

  • true

include_tags

列表 / 元素=字符串

在 theforeman.foreman 3.7.0 中添加

要为容器镜像仓库同步的标签列表。

label

字符串

仓库的标签

mirror_on_sync

布尔值

切换“同步时镜像”,其中仓库的状态在同步时反映上游仓库的状态

此功能在 Katello 4.3 中已弃用

它已被 *mirroring_policy=mirror_content_only* 取代

选项

  • false

  • true

mirroring_policy

字符串

为镜像内容设置的策略

自 Katello 4.3 起受支持

选项

  • "additive"

  • "mirror_content_only"

  • "mirror_complete"

name

字符串 / 必需

仓库的名称

organization

字符串 / 必需

实体所在的组织

os_versions

列表 / 元素=字符串

标识是否应在客户端上禁用与不匹配的操作系统版本不匹配的仓库。

最多可以选择一个操作系统版本。

设置为 [] 以再次禁用筛选。

选项

  • "rhel-6"

  • "rhel-7"

  • "rhel-8"

  • "rhel-9"

password

字符串 / 必需

访问 Foreman 服务器的用户密码。

如果任务中未指定该值,则将改用环境变量 FOREMAN_PASSWORD 的值。

product

字符串 / 必需

仓库所在的 Product

server_url

字符串 / 必需

Foreman 服务器的 URL。

如果任务中未指定该值,则将改用环境变量 FOREMAN_SERVER_URL 的值。

ssl_ca_cert

字符串

仓库 SSL CA 证书

ssl_client_cert

字符串

仓库 SSL 客户端证书

ssl_client_key

字符串

仓库 SSL 客户端私钥

state

字符串

实体的状态

present_with_defaults 将确保实体存在,但不会更新现有实体

选项

  • "present" ← (默认)

  • 使用默认值呈现

  • 不存在

未受保护

布尔值

通过 HTTP 发布仓库

选项

  • false

  • true

上游密码

字符串

访问上游仓库的密码。

设置此参数后,模块将不再是幂等的。

上游用户名

字符串

访问上游仓库的用户名

URL

字符串

要从中同步的仓库 URL

用户名

字符串 / 必需

访问 Foreman 服务器的用户名。

如果任务中未指定此值,则将改用环境变量FOREMAN_USERNAME的值。

验证证书

布尔值

是否验证 Foreman 服务器的 TLS 证书。

如果任务中未指定此值,则将改用环境变量FOREMAN_VALIDATE_CERTS的值。

选项

  • false

  • true ← (默认)

同步时验证SSL

布尔值

验证上游证书是否由受信任的 CA 签名

选项

  • false

  • true

属性

属性

支持

描述

check_mode

支持:完全支持

可以在 check_mode 下运行,并在不修改实体的情况下返回更改状态预测。

diff_mode

支持:完全支持

在 diff 模式下,将返回有关已更改内容(或在 check_mode 下可能需要更改的内容)的详细信息。

注释

注意

  • 您可以使用此模块配置现有 Red Hat 仓库的某些方面(例如 *download_policy*),但不能创建(启用)或删除(禁用)它们。

  • 如果您想启用或禁用通过您的订阅提供的 Red Hat 仓库,请改用 theforeman.foreman.repository_set 模块。

示例

- name: "Create repository"
  theforeman.foreman.repository:
    username: "admin"
    password: "changeme"
    server_url: "https://foreman.example.com"
    name: "My repository"
    state: present
    content_type: "yum"
    product: "My Product"
    organization: "Default Organization"
    url: "http://yum.theforeman.org/plugins/latest/el7/x86_64/"
    mirror_on_sync: true
    download_policy: immediate

- name: "Create repository with content credentials"
  theforeman.foreman.repository:
    username: "admin"
    password: "changeme"
    server_url: "https://foreman.example.com"
    name: "My repository 2"
    state: present
    content_type: "yum"
    product: "My Product"
    organization: "Default Organization"
    url: "http://yum.theforeman.org/releases/latest/el7/x86_64/"
    download_policy: on_demand
    mirror_on_sync: true
    gpg_key: RPM-GPG-KEY-my-product2

返回值

常用返回值已在此处 记录,以下是此模块独有的字段

描述

实体

字典

按类型分组的受影响实体的最终状态。

返回:成功

仓库

列表 / 元素=字典

仓库列表。

返回:成功

作者

  • Eric D Helms (@ehelms)