powerdns
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
- Archlinux , , , , , ,
Start using this module
Add this module to your Puppetfile:
mod 'sensson-powerdns', '5.0.0'
Learn more about managing modules with a PuppetfileDocumentation
PowerDNS
This module can be used to configure both the recursor and authoritative PowerDNS 4 server. It officially supports Puppet 7 and higher.
Examples
Installation and configuration
This will install the authoritative PowerDNS server which includes the MySQL server and the management of the database and its tables. This is the bare minimum.
class { 'powerdns':
db_password => 's0m4r4nd0mp4ssw0rd',
db_root_password => 'v3rys3c4r3',
}
If you want to install both the recursor and the authoritative service on the same server it is recommended to have the services listen on their own IP address. The example below needs to be adjusted to use the ip addresses of your server.
This may fail the first time on Debian-based distro's.
powerdns::config { 'authoritative-local-address':
type => 'authoritative',
setting => 'local-address',
value => '127.0.0.1',
}
powerdns::config { 'recursor-local-address':
type => 'recursor',
setting => 'local-address',
value => '127.0.0.2',
}
class { 'powerdns':
db_password => 's0m4r4nd0mp4ssw0rd',
db_root_password => 'v3rys3c4r3',
recursor => true,
}
Recursor forward zones
Multiple forward zones can be configured using powerdns::forward_zones
.
include powerdns::recursor
The configuration will be serialized into forward-zones-file
config file.
powerdns::forward_zones:
'example.com': 10.0.0.1
'foo': 192.168.1.1
# recurse queries
'+.': 1.1.1.1;8.8.8.8;8.8.4.4
Backends
The default backend is MySQL. It also comes with support for PostgreSQL, Bind, LDAP and SQLite.
If you don't specify the backend it assumes you will use MySQL.
class { 'powerdns':
backend => 'mysql',
db_password => 's0m4r4nd0mp4ssw0rd',
}
To use PostgreSQL set backend
to postgresql
.
class { 'powerdns':
backend => 'postgresql',
db_password => 's0m4r4nd0mp4ssw0rd',
}
To use Bind you must set backend_install
and backend_create_tables
to
false. For example:
class { 'powerdns':
backend => 'bind',
backend_install => false,
backend_create_tables => false,
}
To use LDAP you must set backend_install
and backend_create_tables
to
false. For example:
class { 'powerdns':
backend => 'ldap',
backend_install => false,
backend_create_tables => false,
}
To use SQLite you must set backend
to sqlite
. Ensure that the pdns
user
has write permissions to directory holding database file. For example:
class { 'powerdns':
backend => 'sqlite',
db_file => '/opt/powerdns.sqlite3',
}
Manage zones with this module
With this module you can manage zones if you use a backend that is capable of doing so (eg. sqllite, postgres or mysql).
You can add a zone 'example.org' by using:
powerdns_zone{'example.org': }
This will add the zone which is then managed through puppet any records not added through puppet will be deleted additionaly a SOA record is generated. To just ensure the zone is available, but not manage any records use (and do not add any powerdns_record resources with target this domain):
powerdns_zone{'example.org':
manage_records => false,
}
To addjust the SOA record (if add_soa is set to true), use the soa_* parameters documented in the powerdns_record resource.
The zone records can be managed through the powerdns_record resource. As an example we add a NS an A and an AAAA record:
powerdns_record{'nameserver1':
target_zone => 'example.org',
rname => '.', # a dot takes the target_zone only as rname
rtype => 'NS',
rttl => '4242',
rcontent => 'ns1.example.org.' # pay attention to the dot at the end !
}
powerdns_record{'ns1.example.org':
rcontent => '127.0.0.1',
}
powerdns_record{'ipv6-ns1.example.org':
target_zone => 'example.org',
rname => 'ns1', # for the full record, the target_zone will be amended
rtype => 'AAAA',
rcontent => '::1',
}
powerdns_record{'www-server':
target_zone => 'example.org',
rname => 'www',
rcontent => '127.0.0.1'
}
Remark: if the target_zone is not managed with powerdns_zone resource, powerdns_record does not change anything!
Sensitive secrets
Passwords can be passed either as plain-text strings or as Puppet's Sensitive type when appropriate encrypted backend is configured on Puppet server.
Manage autoprimaries (automatic provisioning of secondaries)
It's possible to manage the the 'autoprimaries' with puppet (For a decription of the autoprimary functionality in powerdns see powerdns manual. The autoprimaries are set with the powerdns_autoprimary resource. As an example we add the primary 1.2.3.4 named ns1.example.org whith the account 'test'
powerdns_autoprimary{'1.2.3.4@ns1.example.org':
ensure => 'present',
account => 'test',
}
As an alternative, you can set the autoprimaries parameter of the powerdns class to achive the same (eg. if you use hiera).
For removal of an autoprimary set ensure to 'absent' or set the parameter purge_autoprimaries of the powerdns class to true which willa remove all autoprimaries that are not present in the puppet manifest.
Reference
Parameters
powerdns
We provide a number of configuration options to change particular settings or to override our defaults when required.
authoritative
Install the PowerDNS authoritative server. Defaults to true.
recursor
Install the PowerDNS recursor. Defaults to false.
backend
Choose a backend for the authoritative server. Valid values are 'mysql', 'postgresql' and 'bind'. Defaults to 'mysql'.
backend_install
If you set this to true it will try to install a database backend for
you. This requires db_root_password
. Defaults to true.
backend_create_tables
If set to true, it will ensure the required powerdns tables exist in your
backend database. If your database is on a separate host or you are using the
the Bind backend, set backend_install
and backend_create_tables
to false.
Defaults to true.
db_root_password
If you set backend_install
to true you are asked to specify a root
password for your database. Accepts either String
or Sensitive
type.
db_username
Set the database username. Defaults to 'powerdns'.
db_password
Set the database password. Accepts either String
or Sensitive
type. Default is empty.
db_name
The database you want to use for PowerDNS. Defaults to 'powerdns'.
db_host
The host where your database should be created. Defaults to 'localhost'.
db_port
The port to use when connecting to your database. Defaults to '3306'. Only supported in the MySQL backend currently.
db_file
The file where database will be stored when using SQLite backend. Defaults to '/var/lib/powerdns/powerdns.sqlite3'
ldap_host
The host where your LDAP server can be found. Defaults to 'ldap://localhost/'.
ldap_basedn
The path to search for in LDAP. Defaults to undef.
ldap_method
Defines how LDAP is queried. Defaults to 'strict'.
ldap_binddn
Path to the object to authenticate against. Defaults to undef.
ldap_secret
Password for simple authentication against ldap_basedn. Accepts either String
or Sensitive
type. Defaults to undef.
custom_repo
Don't manage the PowerDNS repo with this module. Defaults to false.
custom_epel
Don't manage the EPEL repo with this module. Defaults to false.
version
Set the PowerDNS version. Defaults to '4.1'.
mysql_schema_file
Set the PowerDNS MySQL schema file. Defaults to the location provided by PowerDNS.
pgsql_schema_file
Set the PowerDNS PostgreSQL schema file. Defaults to the location provided by PowerDNS.
powerdns::authoritative and powerdns::recursor
package_ensure
You can set the package version to be installed. Defaults to 'installed'.
Defines
powerdns::config
All PowerDNS settings can be managed with powerdns::config
. Depending on the
backend we will set a few configuration settings by default. All other
variables can be changed as follows:
powerdns::config { 'api':
ensure => present,
setting => 'api',
value => 'yes',
type => 'authoritative',
}
setting
The setting you want to change.
value
The value for the above setting.
type
The configuration file you want to change. Valid values are 'authoritative', 'recursor'. Defaults to 'authoritative'.
ensure
Specify whether or not this configuration should be present. Valid values are 'present', 'absent'. Defaults to 'present'.
Hiera
This module supports Hiera and uses create_resources to configure PowerDNS if you want to. An example can be found below:
powerdns::db_root_password: 's0m4r4nd0mp4ssw0rd'
powerdns::db_username: 'powerdns'
powerdns::db_password: 's0m4r4nd0mp4ssw0rd'
powerdns::recursor: true
powerdns::recursor::package_ensure: 'latest'
powerdns::authoritative::package_ensure: 'latest'
powerdns::auth::config:
gmysql-dnssec:
value: ''
local-address:
value: '127.0.0.1'
api:
value: 'yes'
Prevent duplicate declaration
In this example we configure local-address
to 127.0.0.1
. If you also
run a recursor on the same server and you would like to configure
local-address
via Hiera you need to set setting
and change the name of
the parameter in Hiera to a unique value.
For example:
powerdns::auth::config:
local-address-auth:
setting: 'local-address'
value: '127.0.0.1'
powerdns::recursor::config:
local-address-recursor:
setting: 'local-address'
value: '127.0.0.2'
If you have other settings that share the same name between the recursor and authoritative server you would have to use the same approach to prevent duplicate declaration errors.
Limitations
This module has been tested on:
- CentOS 7, 8
- Ubuntu 18.04
- Debian 10
We believe it also on other operating systems such as:
- Oracle Linux
- RedHat Enterprise Linux
- Scientific Linux
- Arch Linux
The packages on EL are a bit stupid. The schemas have the exact PowerDNS version hardcoded in the paths. The main class has three parameters where you can adjust it:
mysql_schema_file
pgsql_schema_file
sqlite_schema_file
Development
We strongly believe in the power of open source. This module is our way of saying thanks.
If you want to contribute please:
- Fork the repository.
- Run tests. It's always good to know that you can start with a clean slate.
- Add a test for your change.
- Make sure it passes.
- Push to your fork and submit a pull request to the
main
branch.
We can only accept pull requests with passing tests.
To install all of its dependencies please run:
bundle install --path vendor/bundle --without development
Running unit tests
bundle exec rake test
Running acceptance tests
The unit tests only verify if the code runs, not if it does exactly what we want on a real machine. For this we use Beaker. Beaker will start a new virtual machine (using Vagrant) and runs a series of simple tests.
You can run Beaker tests with:
bundle exec rake spec_prep
BEAKER_destroy=onpass bundle exec rake beaker:centos7
BEAKER_destroy=onpass bundle exec rake beaker:oel7
BEAKER_destroy=onpass bundle exec rake beaker:ubuntu1804
BEAKER_destroy=onpass bundle exec rake beaker:debian10
We recommend specifying BEAKER_destroy=onpass
as it will keep the
Vagrant machine running in case something fails.
Changelog
v5.0.0 - 2024-02-20
Version 4.1.0 included #163, which a backwards incompatible change. This release is to be on par with semver.
Full Changelog: https://github.com/sensson/puppet-powerdns/compare/v4.1.1...v5.0.0
v4.1.1 - 2024-02-15
What's Changed
- Allow postgresql 10 module by @deric in https://github.com/sensson/puppet-powerdns/pull/164
- Puppet 8 support by @deric in https://github.com/sensson/puppet-powerdns/pull/166
- Pdk update & remove .ruby-version file by @deric in https://github.com/sensson/puppet-powerdns/pull/165
Full Changelog: https://github.com/sensson/puppet-powerdns/compare/v4.1.0...v4.1.1
v4.1.0 - 2024-02-06
What's Changed
- add type/provider for autoprimary by @trefzer in https://github.com/sensson/puppet-powerdns/pull/162
- Add the ability to install pdns and recursor with differents versions by @mouchymouchy in https://github.com/sensson/puppet-powerdns/pull/163
New Contributors
- @mouchymouchy made their first contribution in https://github.com/sensson/puppet-powerdns/pull/163
Full Changelog: https://github.com/sensson/puppet-powerdns/compare/v4.0.1...v4.1.0
v4.0.1 - 2023-09-07
What's Changed
- Bugfix: fix deprecated use of postgresql_password() by @sircubbi in https://github.com/sensson/puppet-powerdns/pull/161
New Contributors
- @sircubbi made their first contribution in https://github.com/sensson/puppet-powerdns/pull/161
Full Changelog: https://github.com/sensson/puppet-powerdns/compare/v4.0.0...v4.0.1
v4.0.0 - 2023-08-24
What's Changed
This version drops support for EOL operating systems and Ruby 2.6.
- Drop EoL module support by @bastelfreak in https://github.com/sensson/puppet-powerdns/pull/156
- pdk: Update 2.5.0->3.0.0 by @bastelfreak in https://github.com/sensson/puppet-powerdns/pull/154
- puppetlabs/postgresql: Require 9.x by @bastelfreak in https://github.com/sensson/puppet-powerdns/pull/157
- puppetlabs/stdlib: Require 9.x by @bastelfreak in https://github.com/sensson/puppet-powerdns/pull/152
- puppetlabs/mysql: Allow 15.x by @bastelfreak in https://github.com/sensson/puppet-powerdns/pull/153
- .fixtures.yml: Migrate to git by @bastelfreak in https://github.com/sensson/puppet-powerdns/pull/151
- puppet-strings: autofix by @bastelfreak in https://github.com/sensson/puppet-powerdns/pull/155
- puppet/epel: Allow 5.x by @bastelfreak in https://github.com/sensson/puppet-powerdns/pull/158
- Add Arch Linux support by @bastelfreak in https://github.com/sensson/puppet-powerdns/pull/159
Full Changelog: https://github.com/sensson/puppet-powerdns/compare/v3.0.3...v4.0.0
v3.0.3 - 2023-05-27
What's Changed
- Allow newer dependencies by @saz in https://github.com/sensson/puppet-powerdns/pull/150
Full Changelog: https://github.com/sensson/puppet-powerdns/compare/v3.0.2...v3.0.3
v3.0.2 - 2023-04-01
What's Changed
- chore: update metadata & readme for puppet 7 by @ju5t in https://github.com/sensson/puppet-powerdns/pull/149
Full Changelog: https://github.com/sensson/puppet-powerdns/compare/v3.0.1...v3.0.2
v3.0.1 - 2023-04-01
This release ensures the changelog is updated at Puppet Forge.
Full Changelog: https://github.com/sensson/puppet-powerdns/compare/v3.0.0...v3.0.1
v3.0.0 - 2023-03-31
What's Changed
- Support Sensitive strings by @deric in https://github.com/sensson/puppet-powerdns/pull/148
- BREAKING: drop Puppet 6 support as this version is EOL since 28-02-2023.
Full Changelog: https://github.com/sensson/puppet-powerdns/compare/v2.3.0...v3.0.0
2.3.0 and onwards
Our changelog will be published on our releases page.
2.2.2
Bumps PostgreSQL requirement.
2.2.1
Incorrect tag.
2.2.0
This release adds support for PowerDNS resources.
Features
- Add support for PowerDNS resources.
- Support Rocky Linux
- Support PowerDNS 4.6
2.1.4
This release adds package_ensure to all backends.
2.1.3
This release updates the dependencies and adds support for PowerDNS 4.5.
Features
- Add support for PowerDNS 4.5.
2.1.2
Summary
A number of dependency version bumps and a fix for the
sqlite schema on RHEL servers has been added. At the same
time, we're dropping the develop
branch from this
repository as it confusing for a lot of people and
serves no real purpose here.
2.1.1
Summary
Nothing was changed, but due to an incorrect merge the data in 2.1.0 became invalid.
2.1.0
Summary
This release adds preliminary support for FreeBSD and also adds support for PowerDNS 4.4.
Features
- Preliminary support for FreeBSD.
- Allow additional values to be empty in the config.
Bugs
- Authoritative and recursor package depend on apt repo (#80)
2.0.0
Summary
This release drops support for EOL operating systems and Puppet 4. Puppet 5 is now the minimum requirement. It adds support for Puppet 7.
CI has been switched from Travis CI to Github Actions.
Features
- Support for Puppet 7
Other
- Switched from the old stahnma/epel to puppet/epel
- Switched CI to Github Actions
1.7.2
Summary
This release adds PowerDNS 4.3 support and supports CentOS 8.
Features
- Update allowed puppetlabs/apt requirement to 7.6.0.
- Add support for PowerDNS 4.3
- Add support for CentOS 8
1.7.1
Summary
This release updates stahnma/epel to 2.0.0. This is a first step towards CentOS 8 support.
Features
- Update stahnma/epel to 2.0.0.
1.7.0
Summary
This release adds support for PowerDNS 4.2.
Features
- Add support for PowerDNS 4.2
- Configure the database port in the MySQL-backend
- Dependencies have been updated
1.6.0
Summary
This release adds support for Puppet 6 and includes Oracle Linux 7 in our acceptance tests. We have dropped tests for Puppet 4.7 due to the required Rubygem dependencies. We encourage you to upgrade to Puppet 5.10.
Features
- Support for Puppet 6
- Support for Oracle Linux 7
1.5.0
Summary
This release adds support for Ubuntu 18.04, SQLite backend and allows you to override the EPEL-repository on RHEL-servers.
Features
- Support for Ubuntu 18.04.
- Support for SQLite.
- Support for
custom_epel
setting.
Bugs
- Correct Rubocop dependency and styling.
- Remove default Bind-backend on Debian systems.
1.4.0
Summary
This adds support for LDAP as a backend for PowerDNS.
Features
- Support for LDAP as backend.
Bugs
- Remove duplicate packages and settings when
custom_repo
istrue
. - Document duplicate declaration errors when using both the recursor and
- authoritative service.
1.3.0
Summary
This completes support for PostgreSQL and adds Bind as backend for PowerDNS.
Features
- Full support for PostgreSQL as backend.
- Support for Bind as backend.
- Support for Debian 9.
1.2.3
Summary
This release reimplements the $version
parameter.
Bugs
- The
$version
-functionality was never implemented by accident. - Update apt id to be a full fingerprint.
1.2.2
This release has no code changes. An incorrect file was added to the Forge and this release is to correct that error.
1.2.1
This is a minor release which removes unused template files.
1.2.0
Summary
PowerDNS 4.1 is now the default version. You can switch versions through a
newly introduced parameter $version
. This will change the repositories to
the latest version but it will not update PowerDNS for you, nor does it make
any required database changes.
Features
- Add version support. This also includes the EPEL-repository on RHEL.
- Use the MySQL database schema as provided by PowerDNS.
1.1.0
Features
- Use Puppet 4 datatypes.
- Support for
backend_create_tables
, making database management optional. - (Basic) Support for PostgreSQL.
- Support all RedHat flavours.
- Bump apt support to < 5.0.0
Bugs
- Contain private subclasses
- Set
gmysql-host
when managing MySQL. - Allow both String and Integer as value for
powerdns::config
values.
1.0.1
Summary
This marks the long overdue stable release of the PowerDNS module. The 1.0.0 release was missing these release notes so we immediately released 1.0.1.
We have dropped support for Puppet 3 in this release.
Features
- Default to Puppet 4.
- Support removing config with
ensure => absent
. - Use Puppet 4 data types in
config.pp
.
Bugs
- Rubocop updates caused tests to fail.
allow-notify-from
was not allowed to be empty.
0.0.12
Summary
We have dropped Ruby 1.9.3 from our tests and added Rubocop coverage to ensure we write decent code where possible.
Features
- Rubocop coverage for all Ruby code in this module.
Bugfixes
- The README wrongly mentioned listen-address instead of local-address
0.0.11
Summary
This release officially drops support for Puppet 2.
Features
- Allow the
only-notify
PowerDNS configuration setting to be empty. - Improved error messages on failure when setting configurations.
Bugfixes
- Added the recursor to our test suite.
- Update Ruby versions in our test suite.
0.0.10
Summary
Version bump to update forge.puppet.com.
0.0.9
Summary
This release adds 1 feature.
Features
- Added
enable
for the recursor and authoritative service
0.0.8
Summary
This release adds 1 feature and solves 3 bugs.
Features
- Added support for
ensure
to the recursor and authoritative package
Bugfixes
- Make powerdns::config more specific
- Pin rake tests to simplecov-console to 0.3.1
- Only fail on
db_root_password
ifbackend_install
is true
0.0.7
Summary
This release adds support for Debian 8.
Features
- Added support for Debian 8
Bugfixes
- Only try to set config if the corresponding services are used
- Removed our default supermaster-query setting as it was causing issues on 4.x
0.0.6
Summary
This release adds 3 features and solves 1 bug.
Features
- Added support for a custom supermaster-query
- Added support to disable the installation of PowerDNS packages
- Added support to disable the configuration of the PowerDNS repositories
Bugfixes
- Renamed authorative to authoritative according to the PowerDNS manual
0.0.5
Summary
This release adds support for Ubuntu 16.04.
Features
- Added support for Ubuntu 16.04
0.0.4
Summary
This release adds support for Ubuntu 14.04 and CentOS 6.
Features
- Added support for Ubuntu 14.04
- Added support for CentOS 6
- Improved the test suite and included support for Beaker
Bugfixes
- Made sure the repository is added before pdns-recursor is installed
0.0.3
Summary
This release adds spec tests.
Features
- Added spec tests
Bugfixes
- Changed the root_home reference when creating database tables
0.0.2
Summary
This release solves one bug.
Bugfixes
- Added a dependency on the pdns package when configuring MySQL
0.0.1
Summary
Initial release.
Dependencies
- puppetlabs/stdlib (>= 9.0.0 < 10.0.0)
- puppetlabs/mysql (>= 15.0.0 < 16.0.0)
- puppetlabs/postgresql (>= 9.1.0 < 11.0.0)
- puppetlabs/apt (>=2.0.0 < 10.0.0)
- puppet/epel (>=1.0.0 < 6.0.0)