vmware.vmware.deploy_folder_template module – Deploy a VM from a template located in a folder
Note
This module is part of the vmware.vmware collection (version 1.10.1).
You might already have this collection installed if you are using the ansible
package.
It is not included in ansible-core
.
To check whether it is installed, run ansible-galaxy collection list
.
To install it, use: ansible-galaxy collection install vmware.vmware
.
To use it in a playbook, specify: vmware.vmware.deploy_folder_template
.
Synopsis
Create a VM from a template that is located in vCenter. The template must be found in a folder, as opposed to being in a content library.
This module manages the deployed VM, not the template. The template will be unchanged.
To further configure the VM, ensure it is deployed in the powered off state and then use other modules to configure it.
The module basis idempotentency on if the deployed VM exists or not, not the storage or power settings applied at deployment time.
Parameters
Parameter |
Comments |
---|---|
The name of the cluster where the VM should be deployed. Changing this option will not result in the VM being redeployed (it does not affect idempotency).
|
|
The name of the datacenter to use when searching for and deploying resources. |
|
Name of the datastore to store deployed VM and disk.
|
|
Name of the datastore cluster to store deployed VM and disk. Please make sure Storage DRS is active for recommended datastore from the given datastore cluster. If Storage DRS is not enabled, datastore with largest free storage space is selected.
|
|
The name of the ESXi host onto which the virtual machine should be deployed. If If Changing this option will not result in the VM being redeployed (it does not affect idempotency). |
|
The hostname or IP address of the vSphere vCenter server. If the value is not specified in the task, the value of environment variable |
|
The password of the vSphere vCenter server. If the value is not specified in the task, the value of environment variable |
|
The port number of the vSphere vCenter server. If the value is not specified in the task, the value of environment variable Default: |
|
Whether or not the VM should be powered on once it has been deployed. This is only applied when the VM is deployed. If the VM already exists, the power state is not modified. Changing this option will not result in the VM being redeployed (it does not affect idempotency). Choices:
|
|
The 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 |
|
The 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 |
|
The name of a resource pool into which the virtual machine should be deployed. Changing this option will not result in the VM being redeployed (it does not affect idempotency).
|
|
The path to the folder where the template with This parameter is not used if This can be an absolute (/datacenter/vm/my/folder) or relative (my/folder) path. This parameter is mutually exclusive with |
|
The ID of the folder where the template with This parameter is not used if This parameter is mutually exclusive with |
|
The ID of the template to use when deploying. This parameter takes precedence over |
|
The name of the template to use when deploying. You must also supply This parameter is not used if |
|
The username of the vSphere vCenter server. If the value is not specified in the task, the value of environment variable |
|
Allows connection when SSL certificates are not valid. Set to If the value is not specified in the task, the value of environment variable Choices:
|
|
Virtual machine folder into which the virtual machine should be deployed. This can be the absolute folder path, or a relative folder path under /<datacenter>/vm/. See the examples for more info. This option is required if you have more than one VM with the same name in the datacenter. Changing this option will result in the VM being redeployed, since it affects where the module looks for the deployed VM. If not provided, the /<datacenter>/vm/ folder is used. |
|
The name of the VM to deploy. If you have multiple VMs with the same name, you should also supply |
Attributes
Notes
Note
All modules require API write access and hence are not supported on a free ESXi license.
All variables and VMware object names are case sensitive.
Modules may rely on the ‘requests’ python library, which does not use the system certificate store by default. You can specify the certificate store by setting the REQUESTS_CA_BUNDLE environment variable. Example: ‘export REQUESTS_CA_BUNDLE=/path/to/your/ca_bundle.pem’
See Also
See also
- vmware.vmware.folder_template_from_vm
Create a template in a local VCenter folder from an existing VM.
Examples
- name: Create A New VM From A Template
vmware.vmware.deploy_folder_template:
hostname: "https://vcenter"
username: "username"
password: "password"
datacenter: "my-datacenter"
vm_name: "my_vm"
template_name: "my_template"
- name: Create A New Template Using Folders To Specify Which VM and Template
vmware.vmware.deploy_folder_template:
hostname: "https://vcenter"
username: "username"
password: "password"
datacenter: "my-datacenter"
vm_name: "my_vm"
template_name: "my_template"
vm_folder: foo/bar/my/vms
template_folder: /my-datacenter/vm/foo/bar/my/templates