community.vmware.vmware_category_info 模块 – 收集有关 VMware 标签类别的信息
注意
此模块是 community.vmware 集合(版本 5.2.0)的一部分。
如果您正在使用 ansible 包,您可能已经安装了这个集合。它不包含在 ansible-core 中。要检查它是否已安装,请运行 ansible-galaxy collection list。
要安装它,请使用:ansible-galaxy collection install community.vmware。您需要满足更多要求才能使用此模块,请参阅 要求 了解详细信息。
要在 playbook 中使用它,请指定:community.vmware.vmware_category_info。
概要
- 此模块可用于收集有关 VMware 标签类别的信息。 
- 标签功能是在 vSphere 6 版本中引入的,因此此模块在早期版本的 vSphere 中不受支持。 
要求
执行此模块的主机需要满足以下要求。
- vSphere 自动化 SDK 
参数
| 参数 | 注释 | 
|---|---|
| vSphere vCenter 服务器的主机名或 IP 地址。 如果未在任务中指定值,则将使用环境变量  | |
| vSphere vCenter 服务器的密码。 如果未在任务中指定值,则将使用环境变量  | |
| 连接到协议。 选项 
 | |
| 将接收所有 HTTPS 请求并转发它们的 HTTP 代理的端口。 如果未在任务中指定值,则将使用环境变量  | |
| vSphere vCenter 服务器的用户名。 如果未在任务中指定值,则将使用环境变量  | |
| 当 SSL 证书无效时允许连接。 当证书不受信任时设置为  如果未在任务中指定值,则将使用环境变量  选项 
 | 
注意
注意
- 所有模块都需要 API 写入访问权限,因此在免费的 ESXi 许可证上不受支持。 
- 所有变量和 VMware 对象名称都区分大小写。 
示例
- name: Gather info about tag categories
  community.vmware.vmware_category_info:
    hostname: "{{ vcenter_hostname }}"
    username: "{{ vcenter_username }}"
    password: "{{ vcenter_password }}"
  delegate_to: localhost
  register: all_tag_category_info
- name: Gather category id from given tag category
  community.vmware.vmware_category_info:
    hostname: "{{ vcenter_hostname }}"
    username: "{{ vcenter_username }}"
    password: "{{ vcenter_password }}"
  delegate_to: localhost
  register: tag_category_results
- set_fact:
    category_id: "{{ item.category_id }}"
  loop: "{{ tag_category_results.tag_category_info|json_query(query) }}"
  vars:
    query: "[?category_name==`Category0001`]"
- debug: var=category_id
返回值
常见的返回值记录在此处,以下是此模块特有的字段
| 键 | 描述 | 
|---|---|
| 标签类别的元数据 返回:始终 示例:  | 
