vmware.vmware.esxi_host module – Manage VMware ESXi host status in vCenter
Note
This module is part of the vmware.vmware collection (version 2.9.0).
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.esxi_host.
Synopsis
Manage VMware ESXi host status in vCenter, including cluster or folder membership.
The host must be in maintenance mode to remove it or update its placement.
This module does not manage the connection status of hosts in vCenter. That functionality is in vmware.vmware.esxi_connection
The host must be in maintenance mode if it is already registered with vCenter but should be moved to a new cluster or folder.
Parameters
Parameter |
Comments |
|---|---|
The name of the datacenter. |
|
ESXi hostname to manage. |
|
The password to use when authenticating to the ESXi host. Required when |
|
The port on which the ESXi host’s SSL certificate can be seen. This is used when fetching the SSL thumbprint, and is not used if Default: |
|
The username to use when authenticating to the ESXi host. Required when |
|
If true, any folder path parameters are treated as absolute paths. If false, modules will try to intelligently determine if the path is absolute or relative. This option is useful when your environment has a complex folder structure. By default, modules will try to intelligently determine if the path is absolute or relative. They may mistakenly prepend the datacenter name or other folder names, and this option can be used to avoid this. Choices:
|
|
Forces the ESXi host to be added to the vCenter server, even if it is already being managed by another server. The host must be in maintenance mode even if this option is enabled. Choices:
|
|
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: |
|
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 |
|
Specify the host system’s SSL certificate thumbprint. You can run the following command on the host to get the thumbprint - ‘openssl x509 -in /etc/vmware/ssl/rui.crt -fingerprint -sha1 -noout’ If this is not set, the module will attempt to fetch the thumbprint from the host itself. This essentially skips the host certificate verification, since whatever host is presented will be trusted. This option is only used when state is present. If |
|
If set to If set to If set to Choices:
|
|
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:
|
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. Note having this variable set may cause a ‘false’ value for the ‘validate_certs’ option to be ignored in some cases. Example: ‘export REQUESTS_CA_BUNDLE=/path/to/your/ca_bundle.pem’
See Also
See also
- vmware.vmware.esxi_connection
Manage VMware ESXi host connection status in vCenter.
Examples
- name: Make Sure Host Is In A Cluster
vmware.vmware.esxi_host:
datacenter: DC01
cluster: MyCluster
esxi_host_name: 1.1.1.1
esxi_username: root
esxi_password: mypassword!
state: present
- name: Make Sure Host Is In A Folder (Standalone Host)
vmware.vmware.esxi_host:
datacenter: DC01
folder: my/host/folder # or DC01/host/my/host/folder
esxi_host_name: 1.1.1.1
esxi_username: root
esxi_password: mypassword!
state: present
- name: Remove Host From Cluster
vmware.vmware.esxi_host:
datacenter: DC01
esxi_host_name: 1.1.1.1
state: absent
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
|---|---|
Identifying information about the host If the state is absent and the host does not exist, only the name is returned Returned: On success Sample: |
|
Information about the vCenter task, if something changed Returned: On change Sample: |