community / community.vmware / 4.2.0 / module / vmware_folder_info Provides information about folders in a datacenter Authors: David Hewitt (@davidmhewitt)community.vmware.vmware_folder_info (4.2.0) — module
Install with ansible-galaxy collection install community.vmware:==4.2.0
collections: - name: community.vmware version: 4.2.0
The module can be used to gather a hierarchical view of the folders that exist within a datacenter
- name: Provide information about vCenter folders community.vmware.vmware_folder_info: hostname: '{{ vcenter_hostname }}' username: '{{ vcenter_username }}' password: '{{ vcenter_password }}' datacenter: datacenter_name delegate_to: localhost register: vcenter_folder_info
- name: Get information about folders community.vmware.vmware_folder_info: hostname: '{{ vcenter_hostname }}' username: '{{ vcenter_username }}' password: '{{ vcenter_password }}' datacenter: 'Asia-Datacenter1' register: r
- name: Set Managed object ID for the given folder ansible.builtin.set_fact: folder_mo_id: "{{ (r.flat_folder_info | selectattr('path', 'equalto', '/Asia-Datacenter1/vm/tier1/tier2') | map(attribute='moid'))[0] }}"
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 datacenter: aliases: - datacenter_name description: - Name of the datacenter. required: true 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 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
flat_folder_info: description: - list of dict about folders in flat structure returned: success sample: - moid: group-v3 path: /Asia-Datacenter1/vm - moid: group-v44 path: /Asia-Datacenter1/vm/tier1 - moid: group-v45 path: /Asia-Datacenter1/vm/tier1/tier2 type: list folder_info: description: - dict about folders returned: success sample: datastoreFolders: moid: group-v10 path: /DC01/datastore subfolders: Local Datastores: path: /DC01/datastore/Local Datastores subfolders: {} hostFolders: moid: group-v21 path: /DC01/host subfolders: {} networkFolders: moid: group-v31 path: /DC01/network subfolders: {} vmFolders: moid: group-v41 path: /DC01/vm subfolders: Core Infrastructure Servers: moid: group-v42 path: /DC01/vm/Core Infrastructure Servers subfolders: Staging Network Services: moid: group-v43 path: /DC01/vm/Core Infrastructure Servers/Staging Network Services subfolders: {} VMware: moid: group-v44 path: /DC01/vm/Core Infrastructure Servers/VMware subfolders: {} type: dict