community / community.vmware / 4.2.0 / module / vmware_object_custom_attributes_info Gather custom attributes of an object Authors: sky-joker (@sky-joker)community.vmware.vmware_object_custom_attributes_info (4.2.0) — module
Install with ansible-galaxy collection install community.vmware:==4.2.0
collections: - name: community.vmware version: 4.2.0
This module can be gathered custom attributes of an object.
- name: Gather custom attributes of a virtual machine community.vmware.vmware_object_custom_attributes_info: hostname: "{{ vcenter_hostname }}" username: "{{ vcenter_username }}" password: "{{ vcenter_password }}" validate_certs: false object_type: VirtualMachine object_name: "{{ object_name }}" register: vm_attributes
- name: Gather custom attributes of a virtual machine with moid community.vmware.vmware_object_custom_attributes_info: hostname: "{{ vcenter_hostname }}" username: "{{ vcenter_username }}" password: "{{ vcenter_password }}" validate_certs: false object_type: VirtualMachine moid: "{{ moid }}" register: vm_attributes
moid: description: - Managed Object ID of the instance to get if known, this is a unique identifier only within a single vCenter instance. - This is required if O(object_name) is not supplied. type: str port: default: 443 description: - The port number of the vSphere vCenter or ESXi server. - If the value is not specified in the task, the value of environment variable E(VMWARE_PORT) will be used instead. type: int hostname: description: - The hostname or IP address of the vSphere vCenter or ESXi server. - If the value is not specified in the task, the value of environment variable E(VMWARE_HOST) will be used instead. type: str password: aliases: - pass - pwd description: - The password of the vSphere vCenter or ESXi server. - If the value is not specified in the task, the value of environment variable E(VMWARE_PASSWORD) will be used instead. type: str username: aliases: - admin - user description: - The username of the vSphere vCenter or ESXi server. - If the value is not specified in the task, the value of environment variable E(VMWARE_USER) will be used instead. type: str proxy_host: description: - Address of a proxy that will receive all HTTPS requests and relay them. - The format is a hostname or a IP. - If the value is not specified in the task, the value of environment variable E(VMWARE_PROXY_HOST) will be used instead. required: false type: str proxy_port: description: - Port of the HTTP proxy that will receive all HTTPS requests and relay them. - If the value is not specified in the task, the value of environment variable E(VMWARE_PROXY_PORT) will be used instead. required: false type: int object_name: aliases: - name description: - Name of the object to work with. type: str object_type: choices: - Datacenter - Cluster - HostSystem - ResourcePool - Folder - VirtualMachine - DistributedVirtualSwitch - DistributedVirtualPortgroup - Datastore description: - Type of an object to work with. required: true type: str validate_certs: default: true description: - Allows connection when SSL certificates are not valid. Set to V(false) when certificates are not trusted. - If the value is not specified in the task, the value of environment variable E(VMWARE_VALIDATE_CERTS) will be used instead. type: bool
custom_attributes: description: list of custom attributes of an object. returned: always sample: "[\n {\n \"attribute\": \"example01\",\n \"key\": 132,\n\ \ \"type\": \"VirtualMachine\",\n \"value\": \"10\"\n },\n \ \ {\n \"attribute\": \"example02\",\n \"key\": 131,\n \"\ type\": \"VirtualMachine\",\n \"value\": \"20\"\n },\n {\n \ \ \"attribute\": \"example03\",\n \"key\": 130,\n \"type\": \"\ VirtualMachine\",\n \"value\": null\n }\n]" type: list