vmware_host – Add, remove, or move an ESXi host to, from, or within vCenter¶
Synopsis¶
- This module can be used to add, reconnect, or remove an ESXi host to or from vCenter.
- This module can also be used to move an ESXi host to a cluster or folder, or vice versa, within the same datacenter.
Requirements¶
The below requirements are needed on the host that executes this module.
- python >= 2.6
- PyVmomi
- ssl
- socket
- hashlib
Parameters¶
Examples¶
- name: Add ESXi Host to vCenter
vmware_host:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
datacenter: datacenter_name
cluster: cluster_name
esxi_hostname: '{{ esxi_hostname }}'
esxi_username: '{{ esxi_username }}'
esxi_password: '{{ esxi_password }}'
state: present
delegate_to: localhost
- name: Add ESXi Host to vCenter under a specific folder
vmware_host:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
datacenter: datacenter_name
folder: '/Site2/Asia-Cluster/host'
esxi_hostname: '{{ esxi_hostname }}'
esxi_username: '{{ esxi_username }}'
esxi_password: '{{ esxi_password }}'
state: present
add_connected: True
delegate_to: localhost
- name: Reconnect ESXi Host (with username/password set)
vmware_host:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
datacenter: datacenter_name
cluster: cluster_name
esxi_hostname: '{{ esxi_hostname }}'
esxi_username: '{{ esxi_username }}'
esxi_password: '{{ esxi_password }}'
state: reconnect
delegate_to: localhost
- name: Reconnect ESXi Host (with default username/password)
vmware_host:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
datacenter: datacenter_name
cluster: cluster_name
esxi_hostname: '{{ esxi_hostname }}'
state: reconnect
delegate_to: localhost
- name: Add ESXi Host with SSL Thumbprint to vCenter
vmware_host:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
datacenter: datacenter_name
cluster: cluster_name
esxi_hostname: '{{ esxi_hostname }}'
esxi_username: '{{ esxi_username }}'
esxi_password: '{{ esxi_password }}'
esxi_ssl_thumbprint: "3C:A5:60:6F:7A:B7:C4:6C:48:28:3D:2F:A5:EC:A3:58:13:88:F6:DD"
state: present
delegate_to: localhost
Return Values¶
Common return values are documented here, the following are the fields unique to this module:
Key | Returned | Description |
---|---|---|
result
string
|
on successful addition |
metadata about the new host system added
Sample:
Host already connected to vCenter 'vcenter01' in cluster 'cluster01'
|
Status¶
- This module is not guaranteed to have a backwards compatible interface. [preview]
- This module is maintained by the Ansible Community. [community]
Authors¶
- Joseph Callen (@jcpowermac)
- Russell Teague (@mtnbikenc)
- Maxime de Roucy (@tchernomax)
- Christian Kotte (@ckotte)
Hint
If you notice any issues in this documentation, you can edit this document to improve it.