Skip to content
This repository was archived by the owner on Jul 7, 2021. It is now read-only.
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
18 changes: 17 additions & 1 deletion tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
---
- name: Add the OS specific variables
include_vars: '{{ ansible_os_family }}.yml'

- name: install bind packages
apt: pkg={{ item }} state={{ bind_pkg_state }}
with_items: bind_pkgs
when: ansible_os_family == 'Debian'
tags: package

- name: install bind packages
yum: pkg={{ item }} state={{ bind_pkg_state }}
with_items: bind_pkgs
when: ansible_os_family == 'RedHat'
tags: package

- name: setup zone directories
file: dest={{ bind_base_zones_path }}/{{ item }} state=directory owner={{ bind_user }} group={{ bind_group }} mode=0755
with_items:
- masters
- slaves
tags: configuration

- name: setup zones
template: src=named.conf.local.{{ item }}.j2 dest={{ bind_config_basepath }}/named.conf.local.{{ item }} owner={{ bind_user }} group={{ bind_group }} mode=0600
Expand All @@ -16,20 +28,24 @@
- slave
- forward
notify: reload bind
tags: configuration

- name: configure bind
copy: src=named.conf dest={{ bind_config_basepath }}/named.conf owner={{ bind_user }} group={{ bind_group }} mode=0600
notify: restart bind
tags: configuration

- name: configure bind options
template: src=named.conf.options.j2 dest={{ bind_config_basepath }}/named.conf.options owner={{ bind_user }} group={{ bind_group }} mode=0600
notify: restart bind
tags: configuration

- name: Copy master zone files
copy: src={{ bind_masterzones_path }}/db.{{ item.name }} dest={{ bind_base_zones_path }}/{{bind_masterzones_path}} owner={{ bind_user }} group={{ bind_group }}
with_items: bind_config_master_zones
notify: reload bind
tags: bind-zones
tags: zones

- name: start/stop bind service
service: name={{ bind_service_name }} state={{ bind_service_state }} enabled={{ bind_service_enabled }}
tags: service
9 changes: 9 additions & 0 deletions vars/Debian.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
bind_config_basepath: /etc/bind
bind_user: bind
bind_group: bind
bind_service_name: bind9
bind_pkgs:
- bind9
- dnsutils

9 changes: 9 additions & 0 deletions vars/RedHat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
bind_config_basepath: /etc/named
bind_user: named
bind_group: named
bind_service_name: named
bind_pkgs:
- bind
- bind-utils

7 changes: 0 additions & 7 deletions vars/main.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1 @@
---
bind_config_basepath: /etc/bind
bind_user: bind
bind_group: bind
bind_service_name: bind9
bind_pkgs:
- bind9
- dnsutils