Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eliminate dnssec-enable option for bind version 9.16 and newer. Fix #192 #208

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions molecule/default/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ platforms:
# operate within the container. DO NOT use extended privileges in a
# production environment!
privileged: true
cgroupns_mode: host
pre_build_image: true
# Allocate pseudo-TTY
tty: true
Expand All @@ -56,6 +57,7 @@ platforms:
- ${PWD}:/etc/ansible/roles/bertvv.bind:ro
- ${PWD}/library:/root/.ansible/plugins/modules:ro
privileged: true
cgroupns_mode: host
pre_build_image: true
tty: true
environment:
Expand All @@ -73,6 +75,7 @@ platforms:
- ${PWD}:/etc/ansible/roles/bertvv.bind:ro
- ${PWD}/library:/root/.ansible/plugins/modules:ro
privileged: true
cgroupns_mode: host
pre_build_image: true
tty: true
environment:
Expand Down
27 changes: 21 additions & 6 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
- name: Update package cache for Debian based distros
apt:
update_cache: yes
become: yes
become: true
changed_when: false
when: ansible_os_family == 'Debian'
tags: bind
Expand All @@ -41,19 +41,34 @@
package:
pkg: "{{ item }}"
state: present
become: yes
become: true
with_items:
- "{{ bind_packages }}"
tags: bind

- name: Gather the package facts
package_facts:
manager: auto

- name: Extract installed bind version
set_fact:
bind_ver_installed: "{{ ansible_facts.packages[bind_package]
| map(attribute='version') | first
| regex_search('^(.*:)*([0-9]+\\.[0-9]+)\\.(.*)$', '\\2') | first }}"

- name: Discard bind_dnssec_enable for bind >= 9.16
set_fact:
bind_dnssec_enable: false
when: bind_ver_installed is version('9.16', '>=')

- name: Ensure runtime directories referenced in config exist
file:
path: "{{ item }}"
state: directory
owner: "{{ bind_owner }}"
group: "{{ bind_group }}"
mode: 0770
become: yes
become: true
with_items:
- "{{ bind_dir }}/dynamic"
- "{{ bind_dir }}/data"
Expand All @@ -68,7 +83,7 @@
group: "{{ bind_group }}"
mode: 0770
setype: named_cache_t
become: yes
become: true
tags: bind

- name: Create serial, based on UTC UNIX time
Expand Down Expand Up @@ -105,7 +120,7 @@
mode: 0640
setype: named_conf_t
validate: 'named-checkconf %s'
become: yes
become: true
notify: reload bind
tags: bind

Expand All @@ -114,5 +129,5 @@
name: "{{ bind_service }}"
state: started
enabled: true
become: yes
become: true
tags: bind
6 changes: 3 additions & 3 deletions tasks/zones.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
mode: "{{ bind_zone_file_mode }}"
setype: named_zone_t
validate: 'named-checkzone -d {{ item.name }} %s'
become: yes
become: true
with_items:
- "{{ bind_zones }}"
loop_control:
Expand All @@ -109,7 +109,7 @@
mode: "{{ bind_zone_file_mode }}"
setype: named_zone_t
validate: "named-checkzone {{ ('.'.join(item.1.replace(item.1+'.','').split('.')[::-1])) }}.in-addr.arpa %s"
become: yes
become: true
with_subelements:
- "{{ bind_zones }}"
- networks
Expand All @@ -134,7 +134,7 @@
mode: "{{ bind_zone_file_mode }}"
setype: named_zone_t
validate: "named-checkzone {{ (item.1 | ipaddr('revdns'))[-(9+(item.1|regex_replace('^.*/','')|int)//2):] }} %s"
become: yes
become: true
with_subelements:
- "{{ bind_zones }}"
- ipv6_networks
Expand Down
1 change: 1 addition & 0 deletions vars/Archlinux.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Distro specific variables for Arch Linux
---
bind_package: bind

bind_packages:
- python-netaddr
Expand Down
3 changes: 3 additions & 0 deletions vars/Debian.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Distro specific variables for Debian
---
bind_default_python_version: '3'

bind_package: bind9

bind_packages:
- "{{ ( bind_python_version == '3' ) | ternary( 'python3-netaddr', 'python-netaddr' ) }}"
- "{{ ( bind_python_version == '3' ) | ternary( 'python3-dnspython', 'python-dnspython' ) }}"
Expand Down
2 changes: 2 additions & 0 deletions vars/FreeBSD.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Distro specific variables for FreeBSD
---

bind_package: bind911

bind_packages:
- py37-netaddr
- py37-dnspython
Expand Down
3 changes: 3 additions & 0 deletions vars/RedHat.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Distro specific variables for RedHat
---
bind_default_python_version: "{{ ( ansible_distribution_major_version == '8' ) | ternary( '3', '2' ) }}"

bind_package: bind

bind_packages:
- "{{ ( bind_python_version == '3' ) | ternary( 'python3-netaddr', 'python-netaddr' ) }}"
- "{{ ( bind_python_version == '3' ) | ternary( 'python3-dns', 'python-dns' ) }}"
Expand Down