Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Per Lundberg
committed
Jun 1, 2021
1 parent
3aa5bd3
commit 91d4417
Showing
4 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
- name: Runs the bind role | ||
hosts: all | ||
|
||
pre_tasks: | ||
- import_tasks: include/common_pre_tasks.yml | ||
|
||
roles: | ||
- role: bind | ||
|
||
module_defaults: | ||
apt: | ||
force_apt_get: yes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# The path in the inventory to where the files in /etc/bind will be copied from. | ||
# Note that no default value is provided by this role; you must set in the | ||
# inventory on host/group level. | ||
# | ||
# Typical override value: | ||
# {{ inventory_dir }}/overrides/<host>/bind/etc/bind | ||
bind_etc_bind_path: null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
- name: Reload or start the bind service | ||
systemd: | ||
name: bind9.service | ||
state: reloaded | ||
listen: reload_bind | ||
become: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
- name: Ensure mandatory variables are set | ||
fail: | ||
msg: "Mandatory variable bind_etc_bind_path must be set" | ||
when: bind_etc_bind_path == None | ||
|
||
- name: Install/update bind9 | ||
ansible.builtin.package: | ||
name: | ||
- bind9 | ||
|
||
# Deliberately not using 'state: latest' to avoid unexpected surprises when | ||
# e.g. deploying updated configuration. | ||
state: present | ||
become: true | ||
|
||
- name: Find /etc/bind files | ||
find: | ||
paths: '{{ bind_etc_bind_path }}' | ||
patterns: '*' | ||
register: etc_bind_files | ||
delegate_to: 127.0.0.1 | ||
|
||
- name: Copy configuration to /etc/bind | ||
ansible.builtin.template: | ||
src: '{{ item.path }}' | ||
dest: /etc/bind/{{ item.path | basename | replace('.j2', '') }} | ||
owner: root | ||
group: bind | ||
mode: 0644 | ||
backup: false | ||
become: true | ||
loop: '{{ etc_bind_files.files }}' | ||
notify: reload_bind |