# salt.modules.dig

Compendium of generic DNS utilities. The 'dig' command line tool must be installed in order to use this module.

salt.modules.dig.A(host, nameserver=None)

  Return the A record for `host`.

  Always returns a list.

  CLI Example:

      salt ns1 dig.A www.google.com

salt.modules.dig.AAAA(host, nameserver=None)

  Return the AAAA record for `host`.

  Always returns a list.

  CLI Example:

      salt ns1 dig.AAAA www.google.com

salt.modules.dig.CNAME(host, nameserver=None)

  Return the CNAME record for `host`.

  New in version 3005.

  CLI Example:

      salt ns1 dig.CNAME mail.google.com

salt.modules.dig.MX(domain, resolve=False, nameserver=None)

  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 dig.MX google.com

salt.modules.dig.NS(domain, resolve=True, nameserver=None)

  Return a list of IPs of the nameservers for `domain`

  If `resolve` is False, don't resolve names.

  CLI Example:

      salt ns1 dig.NS google.com

salt.modules.dig.SPF(domain, record='SPF', nameserver=None)

  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 dig.SPF google.com

salt.modules.dig.TXT(host, nameserver=None)

  Return the TXT record for `host`.

  Always returns a list.

  CLI Example:

      salt ns1 dig.TXT google.com

salt.modules.dig.a(host, nameserver=None)

  Return the A record for `host`.

  Always returns a list.

  CLI Example:

      salt ns1 dig.A www.google.com

salt.modules.dig.aaaa(host, nameserver=None)

  Return the AAAA record for `host`.

  Always returns a list.

  CLI Example:

      salt ns1 dig.AAAA www.google.com

salt.modules.dig.check_ip(addr)

  Check if address is a valid IP. returns True if valid, otherwise False.

  CLI Example:

      salt ns1 dig.check_ip 127.0.0.1
      salt ns1 dig.check_ip 1111:2222:3333:4444:5555:6666:7777:8888

salt.modules.dig.cname(host, nameserver=None)

  Return the CNAME record for `host`.

  New in version 3005.

  CLI Example:

      salt ns1 dig.CNAME mail.google.com

salt.modules.dig.mx(domain, resolve=False, nameserver=None)

  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 dig.MX google.com

salt.modules.dig.ns(domain, resolve=True, nameserver=None)

  Return a list of IPs of the nameservers for `domain`

  If `resolve` is False, don't resolve names.

  CLI Example:

      salt ns1 dig.NS google.com

salt.modules.dig.spf(domain, record='SPF', nameserver=None)

  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 dig.SPF google.com