community.vmware.vmware_host – Add, remove, or move an ESXi host to, from, or within vCenter¶
Note
This plugin is part of the community.vmware collection (version 1.7.0).
To install it use: ansible-galaxy collection install community.vmware
.
To use it in a playbook, specify: community.vmware.vmware_host
.
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
community.vmware.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
community.vmware.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)
community.vmware.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)
community.vmware.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
community.vmware.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'
|
Authors¶
Joseph Callen (@jcpowermac)
Russell Teague (@mtnbikenc)
Maxime de Roucy (@tchernomax)
Christian Kotte (@ckotte)