ansible/ansible — pull request #3944 by jwriteclub (2013-08-25 03:15:32+00:00)
Title: Added name server facts to the setup module.

Added three new facts to the setup module:

* all_nameservers: A list of IP addresses of all configured name servers.
* default_nameserver: The first IP address in all_nameservers.
* resolv_domain: The value of the 'domain' entry used for searching non-dot terminated domains.

All data are taken from /etc/resolv.conf using http://pic.dhe.ibm.com/infocenter/aix/v6r1/index.jsp?topic=%2Fcom.ibm.aix.files%2Fdoc%2Faixfiles%2Fresolv.conf.htm as a file format reference.

Rationale For This Change
------------------------------------

1. `resolv.conf` is common across systems and has a well defined format, so these changes are likely to result in useful facts on most systems.
1. It is certainly *possible* to list resolvers in vars files related to each host. As the resolvers are facts about the host, it seems to make more sense to provide this information as setup facts.

Example Real World Usage
-------------------------------------

Several nginx modules (including `proxy` and `ocsp_staple`) require a DNS name server specified in the nginx configuration files. Providing these facts allows straightforward creation of compatible configuration files using only the template action.