Configure DNS setup for a Linux server.
Uses systemd-resolved
or network-manager
if installed, else it removes resolvconf
package and configures /etc/resolv.conf
directly.
3.0.0
--- Updated for ansible-core 2.16. Removed support for Ubuntu Xenial and Ubuntu Bionic.2.2.0
--- Added support for Ubuntu 24.042.1.2
--- allow Fedora CoreOS 392.1.1
--- bug fix, ansible-lint2.1.0
--- Initial support for Fedora CoreOS, but with no tests2.0.1
--- bug fix, ansible-lint2.0.0
--- updated for ansible 2.12.91.5.0
--- add RHEL9 + CentOS Stream 8 support1.4.0
--- add jammy support + remove centos8 support1.3.0
--- add rhel8 support + remove trusty and centos61.2.0
--- remove ubuntu precise from testing1.1.1
--- fixed lint warnings1.1.0
--- added ubuntu focal, 20.041.0.4
--- tested with Ansible 2.9.111.0.3
--- prepare for github1.0.2
--- fixed always reload of network manger1.0.1
--- fix run in--check
1.0.0
--- initial versionmaster
--- latest development version
This role is limited to:
- Ubuntu 20.04
- Ubuntu 22.04
- Ubuntu 24.04
- CentOS 7
- CentOS Stream 8
- RHEL 8
- RHEL 9
- Fedora CoreOS 38
- Fedora CoreOS 39
dns_servers
--- list of IPs for DNS servers, default['8.8.8.8', '1.1.1.1']
dns_dnssec
--- boolean value to enable DNSSEC, defaultfalse
. DNSSEC is only configured forsystemd-resolved
.dns_domains
--- list of search domains, default[]
None
Variables are kept in the host_vars
or group_vars
folder usually. Defining everything in playbook is not recommended. This is just an example.
- hosts: servers
vars:
roles:
- role: dns
dns_servers:
- 8.8.8.8
- 1.1.1.1
dns_dnssec: true
dns_domains:
- foo.lan
- bar.lan
NOTICE: Fedora CoreOS is tested manually, but currently no automatic tests are added for FCOS.
Testing the role with Vagrant running on VirtualBox.
cd tests
vagrant up
Rerun tests.
vagrant provision
Remove test VMs.
vagrant destroy -f
GPLv2
Created 2020 by IT Infrastructure at MET Norway
Contactpoint: IT Infrastructure Basis Team