community / community.vmware / 4.2.0 / module / vcenter_folder Manage folders on given datacenter Authors: Abhijeet Kasurde (@Akasurde), Christian Kotte (@ckotte) <christian.kotte@gmx.de>, Jan Meerkamp (@meerkampdvv)community.vmware.vcenter_folder (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 used to create, delete, move and rename folder on then given datacenter.
This module is only supported for vCenter.
- name: Create a VM folder on given datacenter community.vmware.vcenter_folder: hostname: '{{ vcenter_hostname }}' username: '{{ vcenter_username }}' password: '{{ vcenter_password }}' datacenter_name: datacenter_name folder_name: sample_vm_folder folder_type: vm state: present register: vm_folder_creation_result delegate_to: localhost
- name: Create a datastore folder on given datacenter community.vmware.vcenter_folder: hostname: '{{ vcenter_hostname }}' username: '{{ vcenter_username }}' password: '{{ vcenter_password }}' datacenter_name: datacenter_name folder_name: sample_datastore_folder folder_type: datastore state: present register: datastore_folder_creation_result delegate_to: localhost
- name: Create a sub folder under VM folder on given datacenter community.vmware.vcenter_folder: hostname: '{{ vcenter_hostname }}' username: '{{ vcenter_username }}' password: '{{ vcenter_password }}' datacenter_name: datacenter_name folder_name: sample_sub_folder parent_folder: vm_folder state: present register: sub_folder_creation_result delegate_to: localhost
- name: Delete a VM folder on given datacenter community.vmware.vcenter_folder: hostname: '{{ vcenter_hostname }}' username: '{{ vcenter_username }}' password: '{{ vcenter_password }}' datacenter_name: datacenter_name folder_name: sample_vm_folder folder_type: vm state: absent register: vm_folder_deletion_result delegate_to: localhost
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 state: choices: - present - absent default: present description: - State of folder. - If set to V(present) without parent folder parameter, then folder with V(folder_type) is created. - If set to V(present) with parent folder parameter, then folder in created under parent folder. V(folder_type) is ignored. - If set to V(absent), then folder is unregistered and destroyed. type: str 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 folder_name: description: - Name of folder to be managed. - This is case sensitive parameter. - Folder name should be under 80 characters. This is a VMware restriction. required: true type: str folder_type: choices: - datastore - host - network - vm default: vm description: - This is type of folder. - If set to V(vm), then 'VM and Template Folder' is created under datacenter. - If set to V(host), then 'Host and Cluster Folder' is created under datacenter. - If set to V(datastore), then 'Storage Folder' is created under datacenter. - If set to V(network), then 'Network Folder' is created under datacenter. - This parameter is required, if O(state=absent) and O(parent_folder) is not set. - This option is ignored, if O(parent_folder) is set. required: false type: str parent_folder: description: - Name of the parent folder under which new folder needs to be created. - This is case sensitive parameter. - If user wants to create a folder under '/DC0/vm/vm_folder', this value will be 'vm_folder'. - If user wants to create a folder under '/DC0/vm/folder1/folder2', this value will be 'folder1/folder2'. required: false 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
result: contains: msg: description: string stating about result type: str path: description: the full path of the new folder type: str description: The detail about the new folder returned: On success type: complex