community.general.manageiq_group 模块 – ManageIQ 中组的管理

注意

此模块是 community.general 集合 (版本 10.1.0) 的一部分。

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

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

要在 playbook 中使用它,请指定: community.general.manageiq_group

概要

  • manageiq_group 模块支持在 ManageIQ 中添加、更新和删除组。

要求

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

参数

参数

注释

belongsto_filters

列表 / 元素=字符串

包含允许的主机、集群或文件夹引用的字符串列表

belongsto_filters_merge_mode

字符串

在合并模式下,现有设置将与提供的 belongsto_filters 合并。

在替换模式下,当前值将被提供的 belongsto_filters 替换。

选项

  • "merge"

  • "replace" ← (默认)

description

字符串 / 必填

组描述。

managed_filters

字典

每个类别的标签值

managed_filters_merge_mode

字符串

在合并模式下,保留或更新现有类别,并添加新类别。

在替换模式下,所有类别都将被提供的 managed_filters 替换。

选项

  • "merge"

  • "replace" ← (默认)

manageiq_connection

字典

ManageIQ 连接配置信息。

ca_cert

别名:ca_bundle_path

字符串

CA 证书包文件或目录的路径。

password

字符串

ManageIQ 密码。如果已设置,则为 MIQ_PASSWORD 环境变量。否则,如果没有传递令牌,则需要。

token

字符串

ManageIQ 令牌。如果已设置,则为 MIQ_TOKEN 环境变量。否则,如果没有传递用户名或密码,则需要。

url

字符串

ManageIQ 环境 URL。如果已设置,则为 MIQ_URL 环境变量。否则,需要传递它。

username

字符串

ManageIQ 用户名。如果已设置,则为 MIQ_USERNAME 环境变量。否则,如果没有传递令牌,则需要。

validate_certs

别名:verify_ssl

布尔值

是否应验证 HTTPS 请求的 SSL 证书。

选项

  • false

  • true ← (默认)

role

字符串

组角色名称

如果提供,role_id 的优先级高于 role

role_id

整数

组角色 ID

state

字符串

absent - 组不应该存在,present - 组应该存在。

选项

  • "absent"

  • "present" ← (默认)

租户

字符串

由租户名称标识的组的租户。

提供tenant_idtenant优先级更高。

租户名称区分大小写。

tenant_id

整数

由租户ID标识的组的租户。

属性

属性

支持

描述

check_mode

支持: 不支持

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

diff_mode

支持: 不支持

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

示例

- name: Create a group in ManageIQ with the role EvmRole-user and tenant 'my_tenant'
  community.general.manageiq_group:
    description: 'MyGroup-user'
    role: 'EvmRole-user'
    tenant: 'my_tenant'
    manageiq_connection:
      url: 'http://127.0.0.1:3000'
      username: 'admin'
      password: 'smartvm'
      validate_certs: false  # only do this when you trust the network!

- name: Create a group in ManageIQ with the role EvmRole-user and tenant with tenant_id 4
  community.general.manageiq_group:
    description: 'MyGroup-user'
    role: 'EvmRole-user'
    tenant_id: 4
    manageiq_connection:
      url: 'http://127.0.0.1:3000'
      username: 'admin'
      password: 'smartvm'
      validate_certs: false  # only do this when you trust the network!

- name:
  - Create or update a group in ManageIQ with the role EvmRole-user and tenant my_tenant.
  - Apply 3 prov_max_cpu and 2 department tags to the group.
  - Limit access to a cluster for the group.
  community.general.manageiq_group:
    description: 'MyGroup-user'
    role: 'EvmRole-user'
    tenant: my_tenant
    managed_filters:
      prov_max_cpu:
      - '1'
      - '2'
      - '4'
      department:
      - defense
      - engineering
    managed_filters_merge_mode: replace
    belongsto_filters:
    - "/belongsto/ExtManagementSystem|ProviderName/EmsFolder|Datacenters/EmsFolder|dc_name/EmsFolder|host/EmsCluster|Cluster name"
    belongsto_filters_merge_mode: merge
    manageiq_connection:
      url: 'http://127.0.0.1:3000'
      username: 'admin'
      password: 'smartvm'
      validate_certs: false  # only do this when you trust the network!

- name: Delete a group in ManageIQ
  community.general.manageiq_group:
    state: 'absent'
    description: 'MyGroup-user'
    manageiq_connection:
      url: 'http://127.0.0.1:3000'
      username: 'admin'
      password: 'smartvm'

- name: Delete a group in ManageIQ using a token
  community.general.manageiq_group:
    state: 'absent'
    description: 'MyGroup-user'
    manageiq_connection:
      url: 'http://127.0.0.1:3000'
      token: 'sometoken'

返回值

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

描述

group

复杂

组。

返回:成功

belongsto_filters

列表 / 元素=字符串

包含允许的主机、集群或文件夹引用的字符串列表

返回:成功

created_on

字符串

组创建时间

返回:成功

示例:"2018-08-12T08:37:55+00:00"

description

字符串

组描述

返回:成功

group_type

字符串

组类型,系统或用户

返回:成功

id

整数

组ID

返回:成功

managed_filters

字典

每个类别的标签值

返回:成功

role

字符串

组角色名称

返回:成功

租户

字符串

组租户名称

返回:成功

updated_on

整数

组更新日期

返回:成功

示例:"2018-08-12T08:37:55+00:00"

作者

  • Evert Mulder (@evertmulder)