dnsutil.hosts_remove
Remove a host from the /etc/hosts file. If doing so will leave a line
containing only an IP address, then the line will be deleted. This function
will leave comments and blank lines intact.
CLI Examples:
salt '*' dnsutil.hosts_remove /etc/hosts ad1.yuk.co
salt '*' dnsutil.hosts_remove /etc/hosts ad2.yuk.co,ad1.yuk.co
dnsutil.MX
Return a list of lists for the MX of ``domain``.
If the 'resolve' argument is True, resolve IPs for the servers.
It's limited to one IP, because although in practice it's very rarely a
round robin, it is an acceptable configuration and pulling just one IP lets
the data be similar to the non-resolved version. If you think an MX has
multiple IPs, don't use the resolver here, resolve them in a separate step.
CLI Example:
salt ns1 dnsutil.MX google.com
dnsutil.parse_hosts
Parse /etc/hosts file.
CLI Example:
salt '*' dnsutil.parse_hosts
dnsutil.check_ip
Check that string ip_addr is a valid IP
CLI Example:
salt ns1 dnsutil.check_ip 127.0.0.1
dnsutil.NS
Return a list of IPs of the nameservers for ``domain``
If 'resolve' is False, don't resolve names.
CLI Example:
salt ns1 dnsutil.NS google.com
dnsutil.serial
Return, store and update a dns serial for your zone files.
zone: a keyword for a specific zone
update: store an updated version of the serial in a grain
If ``update`` is False, the function will retrieve an existing serial or
return the current date if no serial is stored. Nothing will be stored
If ``update`` is True, the function will set the serial to the current date
if none exist or if the existing serial is for a previous date. If a serial
for greater than the current date is already stored, the function will
increment it.
This module stores the serial in a grain, you can explicitly set the
stored value as a grain named ``dnsserial_<zone_name>``.
CLI Example:
salt ns1 dnsutil.serial example.com
dnsutil.SPF
Return the allowed IPv4 ranges in the SPF record for ``domain``.
If record is ``SPF`` and the SPF record is empty, the TXT record will be
searched automatically. If you know the domain uses TXT and not SPF,
specifying that will save a lookup.
CLI Example:
salt ns1 dnsutil.SPF google.com
dnsutil.hosts_append
Append a single line to the /etc/hosts file.
CLI Example:
salt '*' dnsutil.hosts_append /etc/hosts 127.0.0.1 ad1.yuk.co,ad2.yuk.co
dnsutil.A
Return the A record(s) for ``host``.
Always returns a list.
CLI Example:
salt ns1 dnsutil.A www.google.com
dnsutil.AAAA
Return the AAAA record(s) for ``host``.
Always returns a list.
New in version 2014.7.5
CLI Example:
salt ns1 dnsutil.AAAA www.google.com
dnsutil.parse_zone
Parses a zone file. Can be passed raw zone data on the API level.
CLI Example:
salt ns1 dnsutil.parse_zone /var/lib/named/example.com.zone