The vmware_dns_config module

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.

Get Learn Ansible now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.