community.general.manageiq_policies 模块 – 在 ManageIQ 中管理资源策略配置文件

注意

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

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

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

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

概要

  • manageiq_policies 模块支持在 ManageIQ 中添加和删除策略配置文件。

需求

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

参数

参数

注释

manageiq_connection

字典

ManageIQ 连接配置信息。

ca_cert

别名:ca_bundle_path

字符串

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

密码

字符串

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

令牌

字符串

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

URL

字符串

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

用户名

字符串

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

validate_certs

别名:verify_ssl

布尔值

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

选项

  • false

  • true ← (默认)

policy_profiles

列表 / 元素=字典

字典列表,每个字典都包含 policy_profile name 键。

如果 statepresentabsent,则需要。

resource_id

整数

在 community.general 2.2.0 中添加

应为其[取消]分配配置文件的资源的 ID。

如果未设置 resource_name,则必须指定。这两个选项是互斥的。

resource_name

字符串

应为其[取消]分配配置文件的资源的名称。

如果未设置 resource_id,则必须指定。这两个选项是互斥的。

resource_type

字符串 / 必需

应为其[取消]分配配置文件的资源的类型。

选项

  • "提供商"

  • "主机"

  • "虚拟机"

  • "蓝图"

  • "类别"

  • "集群"

  • "数据 存储"

  • "组"

  • "资源 池"

  • "服务"

  • "服务 模板"

  • "模板"

  • "租户"

  • "用户"

状态

字符串

absent - policy_profiles 不应存在,

present - policy_profiles 应存在,

选项

  • "absent"

  • "present" ← (默认)

属性

属性

支持

描述

check_mode

支持:不支持

可以在 check_mode 中运行并返回更改状态预测,而无需修改目标。

diff_mode

支持:不支持

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

示例

- name: Assign new policy_profile for a provider in ManageIQ
  community.general.manageiq_policies:
    resource_name: 'EngLab'
    resource_type: 'provider'
    policy_profiles:
      - name: openscap profile
    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: Unassign a policy_profile for a provider in ManageIQ
  community.general.manageiq_policies:
    state: absent
    resource_name: 'EngLab'
    resource_type: 'provider'
    policy_profiles:
      - name: openscap profile
    manageiq_connection:
      url: 'http://127.0.0.1:3000'
      username: 'admin'
      password: 'smartvm'
      validate_certs: false  # only do this when you trust the network!

返回值

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

描述

manageiq_policies

字典

列出 ManageIQ 中提供商的当前策略配置文件和策略

返回:始终

示例: {"changed": false, "profiles": [{"policies": [{"active": true, "description": "OpenSCAP", "name": "openscap policy"}, {"active": true, "description": "分析 传入的 容器 镜像", "name": "分析 传入的 容器 镜像"}, {"active": true, "description": "智能 状态 分析后 调度 合规性", "name": "智能 状态 分析后 调度 合规性"}], "profile_description": "OpenSCAP 配置文件", "profile_name": "openscap profile"}]}

作者

  • Daniel Korn (@dkorn)