community.vmware.vmware_category 模块 – 管理 VMware 分类
注意
此模块是 community.vmware 集合 (版本 5.2.0) 的一部分。
如果您使用的是 ansible
包,则可能已经安装了此集合。它不包含在 ansible-core
中。要检查它是否已安装,请运行 ansible-galaxy collection list
。
要安装它,请使用: ansible-galaxy collection install community.vmware
。您需要其他要求才能使用此模块,有关详细信息,请参阅 要求。
要在剧本中使用它,请指定: community.vmware.vmware_category
。
概要
此模块可用于创建/删除/更新 VMware 分类。
标签功能在 vSphere 6 版本中引入,因此此模块在早期版本的 vSphere 中不受支持。
要求
执行此模块的主机需要以下要求。
vSphere 自动化 SDK
参数
参数 |
注释 |
---|---|
可以与给定类别关联的对象类型的列表。 选项
|
|
类别基数。 更新现有类别时,忽略此参数。
选项
|
|
要管理的类别的名称。 |
|
vSphere vCenter 服务器的主机名或 IP 地址。 如果任务中未指定此值,则将使用环境变量 |
|
现有类别的新的名称。 更新现有类别时使用此值。 |
|
vSphere vCenter 服务器的密码。 如果任务中未指定值,则将使用环境变量 |
|
连接协议。 选项
|
|
接收所有 HTTPS 请求并转发它们的 HTTP 代理的端口。 如果任务中未指定值,则将使用环境变量 |
|
类别的状态。 如果设置为 如果设置为 如果设置为 如果设置为 更新类别过程只允许更改名称和描述。 选项
|
|
vSphere vCenter 服务器的用户名。 如果任务中未指定值,则将使用环境变量 |
|
注释
注意
所有模块都需要 API 写入权限,因此在免费 ESXi 许可证上不支持。
所有变量和 VMware 对象名称都区分大小写。
示例
- name: Create a category
community.vmware.vmware_category:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
category_name: Sample_Cat_0001
category_description: Sample Description
category_cardinality: 'multiple'
state: present
- name: Rename category
community.vmware.vmware_category:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
category_name: Sample_Category_0001
new_category_name: Sample_Category_0002
state: present
- name: Update category description
community.vmware.vmware_category:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
category_name: Sample_Category_0001
category_description: Some fancy description
state: present
- name: Delete category
community.vmware.vmware_category:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
category_name: Sample_Category_0002
state: absent
- name: Create category with 2 associable object types
community.vmware.vmware_category:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
category_name: 'Sample_Category_0003'
category_description: 'sample description'
associable_object_types:
- Datastore
- Cluster
state: present
返回值
常见的返回值已在此处记录,以下是此模块独有的字段
键 |
描述 |
---|---|
类别元数据的字典 返回:成功时 示例: |