theforeman.foreman.smart_proxy 模块 – 管理智能代理

注意

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

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

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

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

theforeman.foreman 1.4.0 中的新增功能

概要

  • 创建、更新和删除智能代理

要求

执行此模块的主机需要以下要求。

  • requests

参数

参数

注释

download_policy

字符串

智能代理的下载策略

仅适用于 Katello 安装。

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

自 Katello 4.5 起,提供下载策略 streamed

选项

  • "background"

  • "immediate"

  • "on_demand"

  • "streamed"

  • "inherit"

lifecycle_environments

列表 / 元素=字符串

同步到智能代理的生命周期环境。

仅适用于 Katello 安装。

locations

列表 / 元素=字符串

应将实体分配到的位置列表

name

字符串 / 必需

智能代理的名称

organizations

列表 / 元素=字符串

应将实体分配到的组织列表

password

字符串 / 必需

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

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

server_url

字符串 / 必需

Foreman 服务器的 URL。

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

state

字符串

实体的状态

选项

  • "present" ← (默认)

  • "absent"

url

字符串 / 必需

智能代理的 URL

username

字符串 / 必需

访问 Foreman 服务器的用户名。

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

validate_certs

布尔值

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

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

选项

  • false

  • true ← (默认)

属性

属性

支持

描述

check_mode

支持:完全支持

可以在 check_mode 下运行并返回更改状态预测,而无需修改实体

diff_mode

支持:完全支持

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

备注

注意

  • 即使使用 *state=present*,此模块也不会安装新的智能代理。

  • 它只能关联在指定的 *url* 处侦听的现有智能代理。

  • 考虑使用 *foreman-installer* 创建智能代理。

示例

# Create a local Smart Proxy
- name: "Create Smart Proxy"
  theforeman.foreman.smart_proxy:
    username: "admin"
    password: "changeme"
    server_url: "https://{{ ansible_fqdn }}"
    name: "{{ ansible_fqdn }}"
    url: "https://{{ ansible_fqdn }}:9090"
    download_policy: "immediate"
    lifecycle_environments:
      - "Development"
    organizations:
      - "Default Organization"
    locations:
      - "Default Location"
    state: present

返回值

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

描述

entity

字典

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

返回:成功

smart_proxies

列表 / 元素=字典

智能代理列表。

返回:成功

作者

  • James Stuart (@jstuart)

  • Matthias M Dellweg (@mdellweg)

  • Jeffrey van Pelt (@Thulium-Drake)