theforeman.foreman.content_view_version 模块 – 管理内容视图版本

注意

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

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

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

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

theforeman.foreman 1.0.0 中的新功能

概要

  • 发布、升级或删除内容视图版本

别名:katello_content_view_version

要求

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

  • requests

参数

参数

注释

content_view

string / 必需

内容视图的名称

current_lifecycle_environment

字符串

已与内容视图版本关联的生命周期环境

有助于升级内容视图版本

description

字符串

内容视图版本的描述

force_promote

别名:force

布尔值

强制内容视图升级并绕过生命周期环境限制

选项

  • false ←(默认)

  • true

force_yum_metadata_regeneration

布尔值

执行发布和升级任务时强制重新生成元数据

选项

  • false ←(默认)

  • true

lifecycle_environments

list / elements=string

内容视图版本应在的生命周期环境。

organization

string / 必需

实体所在的组织

password

string / 必需

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

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

server_url

string / 必需

Foreman 服务器的 URL。

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

state

字符串

实体的状态

选项

  • "present" ←(默认)

  • "absent"

username

string / 必需

访问 Foreman 服务器的用户名。

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

validate_certs

布尔值

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

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

选项

  • false

  • true ←(默认)

version

字符串

内容视图版本号(即 1.0)

属性

属性

支持

描述

check_mode

支持: 完全

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

diff_mode

支持: 完全

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

备注

注意

  • 您不能使用此选项从生命周期环境中删除内容视图版本,您应该先升级另一个版本。

  • 为了实现幂等性,您必须指定 versioncurrent_lifecycle_environment

示例

- name: "Ensure content view version 2.0 is in Test & Pre Prod"
  theforeman.foreman.content_view_version:
    username: "admin"
    password: "changeme"
    server_url: "https://foreman.example.com"
    content_view: "CV 1"
    organization: "Default Organization"
    version: "2.0"
    lifecycle_environments:
      - Test
      - Pre Prod

- name: "Ensure content view version in Test is also in Pre Prod"
  theforeman.foreman.content_view_version:
    username: "admin"
    password: "changeme"
    server_url: "https://foreman.example.com"
    content_view: "CV 1"
    organization: "Default Organization"
    current_lifecycle_environment: Test
    lifecycle_environments:
      - Pre Prod

- name: "Publish a content view, not idempotent"
  theforeman.foreman.content_view_version:
    username: "admin"
    password: "changeme"
    server_url: "https://foreman.example.com"
    content_view: "CV 1"
    organization: "Default Organization"

- name: "Publish a content view and promote that version to Library & Dev, not idempotent"
  theforeman.foreman.content_view_version:
    username: "admin"
    password: "changeme"
    server_url: "https://foreman.example.com"
    content_view: "CV 1"
    organization: "Default Organization"
    lifecycle_environments:
      - Library
      - Dev

- name: "Ensure content view version 1.0 doesn't exist"
  theforeman.foreman.content_view_version:
    username: "admin"
    password: "changeme"
    server_url: "https://foreman.example.com"
    content_view: "Web Servers"
    organization: "Default Organization"
    version: "1.0"
    state: absent

# Obtain information about a Content View and its versions
- name: find all CVs
  theforeman.foreman.resource_info:
    username: "admin"
    password: "changeme"
    server_url: "https://foreman.example.com"
    organization: "Default Organization"
    resource: content_views
    search: 'name="Example Content"'
  register: example_content

# Obtain more details about all versions of a specific Content View
- name: "find content view versions of {{ cv_id }}"
  theforeman.foreman.resource_info:
    username: "admin"
    password: "changeme"
    server_url: "https://foreman.example.com"
    organization: "Default Organization"
    resource: content_view_versions
    params:
      content_view_id: "{{ example_content.resources[0].id }}"
  register: version_information

返回值

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

描述

entity

字典

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

返回:成功

content_view_versions

list / elements=dictionary

内容视图版本的列表。

返回:成功

作者

  • Sean O’Keeffe (@sean797)