PowerDNS.pdns
Ansible Role: PowerDNS Authoritative Server
This is an Ansible role to set up the PowerDNS Authoritative Server, created by the team at PowerDNS.
Requirements
You need Ansible version 2.12 or newer to use this role.
Dependencies
There are no dependencies for this role.
Role Variables
Here are the available variables with their default settings (check defaults/main.yml
for details):
pdns_install_repo: ""
By default, the PowerDNS Authoritative Server installs from the target hosts' software repositories.
Examples for Installation
- Install from the 'master' official repository:
- hosts: all
roles:
- { role: PowerDNS.pdns,
pdns_install_repo: "{{ pdns_auth_powerdns_repo_master }}" }
- Install from the '4.7.x' repository:
- hosts: all
roles:
- { role: PowerDNS.pdns,
pdns_install_repo: "{{ pdns_auth_powerdns_repo_47 }}" }
(The full list of predefined repositories is in vars/main.yml
)
Custom Repositories
You can install from custom repositories. Here’s an example:
- hosts: all
vars:
pdns_install_repo:
name: "powerdns"
apt_repo_origin: "example.com"
apt_repo: "deb http://example.com/{{ ansible_distribution | lower }} {{ ansible_distribution_release | lower }}/pdns main"
gpg_key: "http://example.com/MYREPOGPGPUBKEY.asc"
gpg_key_id: "MYREPOGPGPUBKEYID"
yum_repo_baseurl: "http://example.com/centos/$basearch/$releasever/pdns"
yum_debug_symbols_repo_baseurl: "http://example.com/centos/$basearch/$releasever/pdns/debug"
roles:
- { role: PowerDNS.pdns }
Note: These repositories will be ignored on Arch Linux.
EPEL Package Installation
You can choose to install EPEL to fulfill some dependencies by setting:
pdns_install_epel: True
If you want to skip EPEL installation, set it to False
.
Package Name and Version
pdns_package_name: "{{ default_pdns_package_name }}"
This refers to the package name; pdns
for RedHat-like systems and pdns-server
for Debian-like systems.
You can specify a specific package version:
pdns_package_version: ""
Debug Symbols
You can install debug symbols by setting:
pdns_install_debug_symbols_package: False
And specify the debug package name:
pdns_debug_symbols_package_name: "{{ default_pdns_debug_symbols_package_name }}"
User and Group
Specify the user and group for the PowerDNS server:
pdns_user: pdns
pdns_group: pdns
NOTE: This role doesn’t create the user or group.
Service Settings
Specify the service name and state:
pdns_service_name: "pdns"
pdns_service_state: "started"
pdns_service_enabled: "yes"
Configuration Directory
Specify the configuration directory and file:
pdns_config_dir: "{{ default_pdns_config_dir }}"
pdns_config_file: "pdns.conf"
PowerDNS Configuration
You can set up the configuration as a dictionary:
pdns_config: {}
Backend Configuration
Declare backends you want to enable:
pdns_backends:
bind:
config: '/dev/null'
MySQL Credentials
Specify MySQL administrative credentials for backend creation:
pdns_mysql_databases_credentials: {}
SQLite and LMDB Setup
Locations for SQLite3 and LMDB databases for gsqlite3
and lmdb
backends can be defined as:
pdns_sqlite_databases_locations: []
pdns_lmdb_databases_locations: []
Example Playbooks
For setting up a master with the bind backend:
- hosts: ns1.example.net
roles:
- { role: PowerDNS.pdns }
vars:
pdns_config:
master: true
local-address: '192.0.2.53'
pdns_backends:
bind:
config: '/etc/named/named.conf'
To install the latest PowerDNS with MySQL backend:
- hosts: ns2.example.net
roles:
- { role: PowerDNS.pdns }
vars:
pdns_config:
master: true
local-address: '192.0.2.77'
pdns_backends:
gmysql:
host: 192.0.2.120
user: powerdns
password: P0w3rDn5
dbname: pdns
pdns_mysql_databases_credentials:
gmysql:
priv_user: root
priv_password: myrootpass
priv_host:
- "%"
For running in master mode with PostgreSQL databases:
- hosts: ns2.example.net
roles:
- { role: PowerDNS.pdns }
vars:
pdns_config:
master: true
local-address: '192.0.2.111'
pdns_backends:
'gpgsql:serverone':
host: 192.0.2.124
'gpgsql:otherserver':
host: 192.0.2.125
Changelog
For a detailed list of changes, check the changelog here.
Testing
Use Molecule for tests.
Install Tox:
$ pip install tox
To test all scenarios, run:
$ tox
For custom commands:
$ tox -e ansible214 -- molecule test -s pdns-49
License
This role is licensed under the MIT License.
Install and configure the PowerDNS Authoritative DNS Server
ansible-galaxy install PowerDNS.pdns