This module lets you manage the DNS aspects of your ESXi host; it lets you set the hostname, domain, and the DNS resolvers:
- name: Configure the hostname and dns servers
local_action
module: vmware_dns_config:
hostname: "{{ exsi_host }}"
username: "{{ exsi_username }}"
password: "{{ exsi_password }}"
validate_certs: "no"
change_hostname_to: "esxi-host-01"
domainname: "my-domain.com"
dns_servers:
- "8.8.8.8"
- "8.8.4.4"
In the previous example, we are setting the FQDN of the host to be esxi-host-01.my-domain.com and also configuring the host to use Google public DNS resolvers.