Version information
This version is compatible with:
- Puppet Enterprise 2023.8.x, 2023.7.x, 2023.6.x, 2023.5.x, 2023.4.x, 2023.3.x, 2023.2.x, 2023.1.x, 2023.0.x, 2021.7.x, 2021.6.x, 2021.5.x, 2021.4.x, 2021.3.x, 2021.2.x, 2021.1.x, 2021.0.x
- Puppet >= 7.0.0 < 9.0.0
Start using this module
Add this module to your Puppetfile:
mod 'puppet-dnsquery', '5.1.0'
Learn more about managing modules with a PuppetfileDocumentation
Overview
This module provides functions for querying dns records
Setup
$ sudo puppet module install puppet-dnsquery
Usage
Since puppet/dnsquery
version 4, all functions are provided under the dnsquery
namespace.
Non namespaced versions will be removed in version 5
All functions are documented in REFERENCE.md
Development
We highly welcome new contributions to this module, especially those that include documentation, and rspec tests ;) but will happily guide you through the process, so, yes, please submit that pull request!
Please see the contributing guide for more information
Reference
Table of Contents
Functions
dnsquery::a
: Retrieves DNS A records for a domain and returns them as an array.dnsquery::aaaa
: Retrieves DNS AAAA records for a domain and them it as an array.dnsquery::cname
: Retrieves a DNS CNAME record for a domain and returns it as a string.dnsquery::lookup
: Do a DNS lookup and returns an array of addresses. This will follow CNAMEs and return any matching IPv4 or IPv6 addresses. See the more specidnsquery::mx
: Retrieves DNS MX records for a domain and returns them as an array.dnsquery::ptr
: Retrieves DNS PTR records for a domain and returns them as an array.dnsquery::rlookup
: Retrieves results from DNS reverse lookup and returns it as an array.dnsquery::soa
: Retrieves DNS SOA records and returns it as a hash.dnsquery::srv
: Retirve the SRV domain for a specific domaindnsquery::txt
: Retrieves DNS TXT records for a domain and return as an array.
Data types
Dnsquery::Config_info
: Type to validate the config_info passed to Resolve::DNS.newDnsquery::Mx
: type used for DNS MX recordsDnsquery::Soa
: type used for DNS SOA recordsDnsquery::Srv
: type used for DNS SRV records
Functions
dnsquery::a
Type: Ruby 4.x API
Retrieves DNS A records for a domain and returns them as an array.
dnsquery::a(Stdlib::Fqdn $domain, Optional[Optional[Dnsquery::Config_info]] $config_info, Optional[Callable] &$block)
Retrieves DNS A records for a domain and returns them as an array.
Returns: Array[Stdlib::IP::Address::V4::Nosubnet]
An array of A answers matching domain
domain
Data type: Stdlib::Fqdn
the dns domain to lookup
config_info
Data type: Optional[Optional[Dnsquery::Config_info]]
used to override the config for Resolve::DNS.new
&block
Data type: Optional[Callable]
an optional lambda to return a default value in case the lookup fails
dnsquery::aaaa
Type: Ruby 4.x API
Retrieves DNS AAAA records for a domain and them it as an array.
dnsquery::aaaa(Stdlib::Fqdn $domain, Optional[Optional[Dnsquery::Config_info]] $config_info, Optional[Callable] &$block)
Retrieves DNS AAAA records for a domain and them it as an array.
Returns: Array[Stdlib::IP::Address::V6::Nosubnet]
An array of AAAA records matching domain
domain
Data type: Stdlib::Fqdn
the dns domain to lookup
config_info
Data type: Optional[Optional[Dnsquery::Config_info]]
used to override the config for Resolve::DNS.new
&block
Data type: Optional[Callable]
an optional lambda to return a default value in case the lookup fails
dnsquery::cname
Type: Ruby 4.x API
Retrieves a DNS CNAME record for a domain and returns it as a string.
dnsquery::cname(Stdlib::Fqdn $domain, Optional[Optional[Dnsquery::Config_info]] $config_info, Optional[Callable] &$block)
Retrieves a DNS CNAME record for a domain and returns it as a string.
Returns: String
An string representing the CNAME of a domain
domain
Data type: Stdlib::Fqdn
the dns domain to lookup
config_info
Data type: Optional[Optional[Dnsquery::Config_info]]
used to override the config for Resolve::DNS.new
&block
Data type: Optional[Callable]
an optional lambda to return a default value in case the lookup fails
dnsquery::lookup
Type: Ruby 4.x API
Do a DNS lookup and returns an array of addresses. This will follow CNAMEs and return any matching IPv4 or IPv6 addresses. See the more specific functions if you only want one type returned.
dnsquery::lookup(Stdlib::Fqdn $domain, Optional[Boolean] $force_ipv6, Optional[Optional[Dnsquery::Config_info]] $config_info, Optional[Callable] &$block)
Do a DNS lookup and returns an array of addresses. This will follow CNAMEs and return any matching IPv4 or IPv6 addresses. See the more specific functions if you only want one type returned.
Returns: Array[Stdlib::IP::Address::Nosubnet]
An array of A and AAAA answers matching domain
domain
Data type: Stdlib::Fqdn
the dns domain to lookup
force_ipv6
Data type: Optional[Boolean]
ensure we get AAAA answers even if the requestor has no global ipv6 address
config_info
Data type: Optional[Optional[Dnsquery::Config_info]]
used to override the config for Resolve::DNS.new
&block
Data type: Optional[Callable]
an optional lambda to return a default value in case the lookup fails
dnsquery::mx
Type: Ruby 4.x API
Retrieves DNS MX records for a domain and returns them as an array.
dnsquery::mx(Stdlib::Fqdn $domain, Optional[Optional[Dnsquery::Config_info]] $config_info, Optional[Callable] &$block)
Retrieves DNS MX records for a domain and returns them as an array.
Returns: Array[Dnsquery::Mx]
An array of hashes representing the mx records for domain
domain
Data type: Stdlib::Fqdn
the dns domain to lookup
config_info
Data type: Optional[Optional[Dnsquery::Config_info]]
used to override the config for Resolve::DNS.new
&block
Data type: Optional[Callable]
an optional lambda to return a default value in case the lookup fails
dnsquery::ptr
Type: Ruby 4.x API
Retrieves DNS PTR records for a domain and returns them as an array.
dnsquery::ptr(Stdlib::Fqdn $domain, Optional[Optional[Dnsquery::Config_info]] $config_info, Optional[Callable] &$block)
Retrieves DNS PTR records for a domain and returns them as an array.
Returns: Array[Stdlib::Fqdn]
An array of PTR answeres matching domain
domain
Data type: Stdlib::Fqdn
the dns domain to lookup
config_info
Data type: Optional[Optional[Dnsquery::Config_info]]
used to override the config for Resolve::DNS.new
&block
Data type: Optional[Callable]
an optional lambda to return a default value in case the lookup fails
dnsquery::rlookup
Type: Ruby 4.x API
Retrieves results from DNS reverse lookup and returns it as an array.
dnsquery::rlookup(Stdlib::IP::Address::Nosubnet $address, Optional[Optional[Dnsquery::Config_info]] $config_info, Optional[Callable] &$block)
Retrieves results from DNS reverse lookup and returns it as an array.
Returns: Array[Stdlib::Fqdn]
An array of hostnames matching the ip address
address
Data type: Stdlib::IP::Address::Nosubnet
the ip address to lookup
config_info
Data type: Optional[Optional[Dnsquery::Config_info]]
used to override the config for Resolve::DNS.new
&block
Data type: Optional[Callable]
an optional lambda to return a default value in case the lookup fails
dnsquery::soa
Type: Ruby 4.x API
Retrieves DNS SOA records and returns it as a hash.
dnsquery::soa(Stdlib::Fqdn $question, Optional[Optional[Dnsquery::Config_info]] $config_info, Optional[Callable] &$block)
Retrieves DNS SOA records and returns it as a hash.
Returns: Dnsquery::Soa
The SOA record matching domain
question
Data type: Stdlib::Fqdn
the dns question to lookup
config_info
Data type: Optional[Optional[Dnsquery::Config_info]]
used to override the config for Resolve::DNS.new
&block
Data type: Optional[Callable]
an optional lambda to return a default value in case the lookup fails
dnsquery::srv
Type: Ruby 4.x API
Retirve the SRV domain for a specific domain
dnsquery::srv(String $domain, Optional[Optional[Dnsquery::Config_info]] $config_info, Optional[Callable] &$block)
Retirve the SRV domain for a specific domain
Returns: Array[Dnsquery::Srv]
The srv records for domain as an array of hashs
domain
Data type: String
the dns question to lookup
config_info
Data type: Optional[Optional[Dnsquery::Config_info]]
used to override the config for Resolve::DNS.new
&block
Data type: Optional[Callable]
an optional lambda to return a default value in case the lookup fails
dnsquery::txt
Type: Ruby 4.x API
Retrieves DNS TXT records for a domain and return as an array.
dnsquery::txt(Stdlib::Fqdn $domain, Optional[Optional[Dnsquery::Config_info]] $config_info, Optional[Callable] &$block)
Retrieves DNS TXT records for a domain and return as an array.
Returns: Array[String]
The txt domain for a domain
domain
Data type: Stdlib::Fqdn
the dns question to lookup
config_info
Data type: Optional[Optional[Dnsquery::Config_info]]
used to override the config for Resolve::DNS.new
&block
Data type: Optional[Callable]
an optional lambda to return a default value in case the lookup fails
Data types
Dnsquery::Config_info
Type to validate the config_info passed to Resolve::DNS.new
Alias of
Struct[{
'nameserver' => Variant[Stdlib::IP::Address::Nosubnet, Array[Stdlib::IP::Address::Nosubnet]],
Optional['search'] => Array[Stdlib::Fqdn],
Optional['ndots'] => Integer[1,63],
}]
Dnsquery::Mx
type used for DNS MX records
Alias of
Struct[{
preference => Integer[0,65535],
exchange => Stdlib::Fqdn,
}]
Dnsquery::Soa
type used for DNS SOA records
Alias of
Struct[{
mname => Stdlib::Fqdn,
rname => Stdlib::Fqdn,
expire => Integer,
minimum => Integer,
refresh => Integer,
retry => Integer,
serial => Integer,
}]
Dnsquery::Srv
type used for DNS SRV records
Alias of
Struct[{
priority => Integer[0,65535],
weight => Integer[0,65535],
port => Stdlib::Port,
target => Stdlib::Fqdn,
}]
Changelog
All notable changes to this project will be documented in this file. Each new release typically also includes the latest modulesync defaults. These should not affect the functionality of the module.
v5.1.0 (2024-04-09)
Implemented enhancements:
- Add Puppet 8 support #145 (bastelfreak)
- Relax dependencies version requirements #144 (smortex)
v5.0.1 (2023-05-10)
Fixed bugs:
v5.0.0 (2023-04-24)
Breaking changes:
- Drop Puppet 6 support #136 (bastelfreak)
- drop deprecated functions #133 (b4ldr)
- TXT: join text records #127 (b4ldr)
Implemented enhancements:
Fixed bugs:
- fix deprecation warnings #132 (nferch)
- dnsquery::lookup: update lookup so it always resolves AAAA records #131 (b4ldr)
Closed issues:
- dnsquery::lookup dosen't return AAAA if the local machine has no ipv6 #130
v4.0.0 (2023-02-18)
Breaking changes:
Implemented enhancements:
- Add DNS-SOA record. #123 (Heidistein)
Closed issues:
- Vox Pupuli migration #115
- dns_aaaa should return lowercase characters instead #113
- Installs 53M vendor directory from puppetforge #84
- dns_cname: stops puppet with an error if record is not resolvable #57
- dns_ptr is broken on Ubuntu 18.04 #41
- tarball for v3.0.0 on the Forge includes vendored Ruby #13
- Anyone know how to use this in a template? #12
- Non-fatal versions of lookups #8
Merged pull requests:
- Documentation: update the docs strings #126 (b4ldr)
- Fix typos in deprecation warnings #125 (alexjfisher)
- documentation: update readme, references and prepare for release #124 (b4ldr)
- rubocop: fix rubocop violations #122 (b4ldr)
- spec: Fix spec tests #121 (b4ldr)
- aaaa: Ensure AAAA answers are lowercase #120 (b4ldr)
- rubocop: fix violations #119 (b4ldr)
- cleanup: update metadata.json license #118 (b4ldr)
- Add dns_rlookup function. #101 (olifre)
3.0.0 (2017-03-24)
2.0.1 (2015-10-23)
Closed issues:
- release fixed array version #7
Merged pull requests:
- correctly convert array of Resolv::IPv4 or Resolv::IPv6 to array strings #6 (timogoebel)
2.0.0 (2014-10-23)
Closed issues:
- UTF-8 character in module metadata leads to failed catalog compilation #4
1.0.0 (2014-10-14)
Closed issues:
- Tag this version #3
Merged pull requests:
- changed é to e to workaround a puppet utf bug #5 (nustiueudinastea)
0.1.1 (2014-06-19)
Merged pull requests:
0.1.0 (2013-08-30)
Merged pull requests:
* This Changelog was automatically generated by github_changelog_generator
Dependencies
- puppetlabs/stdlib (>= 6.0.0 < 10.0.0)
Copyright (C) 2012 by Erik Dalen <erik.gustav.dalen@gmail.com> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.