theforeman.foreman.scap_tailoring_file 模块 – 管理 SCAP 定制文件

注意

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

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

要安装它,请使用: ansible-galaxy collection install theforeman.foreman。您需要进一步的要求才能使用此模块,请参阅 要求 了解详细信息。

要在剧本中使用它,请指定: theforeman.foreman.scap_tailoring_file

theforeman.foreman 1.0.0 中的新增功能

概要

  • 创建、更新和删除 SCAP 定制文件

别名:foreman_scap_tailoring_file

要求

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

  • requests

参数

参数

注释

locations

list / elements=string

实体应分配到的位置列表

name

string / 必需

定制文件的名称。

organizations

list / elements=string

实体应分配到的组织列表

original_filename

string

XML 文件的原始文件名。

如果未设置,将使用 *scap_file* 的文件名。

password

string / 必需

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

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

scap_file

path

包含 XML 数据流内容的文件。

创建新的数据流时是必需的。

server_url

string / 必需

Foreman 服务器的 URL。

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

state

string

实体的状态

选择

  • "present" ← (默认)

  • "absent"

updated_name

string

定制文件的新名称。

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

username

string / 必需

访问 Foreman 服务器的用户名。

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

validate_certs

boolean

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

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

选择

  • false

  • true ← (默认)

属性

属性

支持

描述

check_mode

支持: 完全

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

diff_mode

支持: 完全

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

示例

- name: Create SCAP tailoring file
  theforeman.foreman.scap_tailoring_file:
    name: "Red Hat firefox default content"
    scap_file: "/home/user/Downloads/ssg-firefox-ds-tailoring.xml"
    original_filename: "ssg-firefox-ds-tailoring.xml"
    organizations:
      - "Default Organization"
    locations:
      - "Default Location"
    server_url: "https://foreman.example.com"
    username: "admin"
    password: "changeme"
    state: present

- name: Update SCAP tailoring file
  theforeman.foreman.scap_tailoring_file:
    name: "Red Hat firefox default content"
    updated_name: "Updated tailoring file name"
    scap_file: "/home/user/Downloads/updated-ssg-firefox-ds-tailoring.xml"
    original_filename: "updated-ssg-firefox-ds-tailoring.xml"
    organizations:
      - "Org One"
      - "Org Two"
    locations:
      - "Loc One"
      - "Loc Two"
    server_url: "https://foreman.example.com"
    username: "admin"
    password: "changeme"
    state: present

- name: Delete SCAP tailoring file
  theforeman.foreman.scap_tailoring_file:
    name: "Red Hat firefox default content"
    server_url: "https://foreman.example.com"
    username: "admin"
    password: "changeme"
    state: absent

返回值

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

描述

entity

dictionary

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

已返回: 成功

scap_tailoring_files

list / elements=dictionary

scap 定制文件的列表。

已返回: 成功

作者

  • Evgeni Golov (@evgeni)