-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbind.pb
60 lines (60 loc) · 1.59 KB
/
bind.pb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
---
# bind9
# expects: zoneset - configuration file for a set of zones to load
- hosts: all
tags:
- packages
- root
gather_facts: False
vars:
TYPE: bind
INSTANCE: main
ETC_DIRS:
- named.conf.local.d
- zone.d
STOCK:
- bind.keys
- db.0
- db.127
- db.255
- db.empty
- db.local
- db.root
- named.conf.default-zones
- zones.rfc1918
ETC_FILES:
- named.conf
- named.conf.options
CACHE_DIRS:
- .
LOG_DIRS:
- .
rndc_key: False
user: bind
port: 53
vars_files:
- vars/common.vars
- vars/srv.vars
- files/bind/defaults.vars
- [ "private/bind/$zoneset.vars", "private/bind9.vars" ]
handlers:
- include: handlers.yml
tasks:
- include: tasks/cfvar_includes.tasks
- apt: state=${APT_INSTALL} pkg=bind9,bind9-doc,dnsutils
- user: name=${user} system=true home={{DIR}}
- set_fact: zoneset=GLOBAL
only_if: is_unset("{{zoneset}}")
- template: src=files/bind/named.conf.local dest={{ETC}}/named.conf.local.d/{{zoneset}}.{{item.name}}.conf
with_items: $domains
- assemble: src={{ETC}}/named.conf.local.d dest={{ETC}}/named.conf.local
notify: restart service
- template: src=files/bind/zone dest={{ETC}}/zone.d/${item.name}.zone
with_items: $domains
notify: restart service
- file: src=/etc/bind/$item dest={{ETC}}/$item state=link
with_items: $STOCK
- template: src=private/bind/rndc.key dest={{ETC}}/rndc.key
only_if: "not not ${rndc_key}"
- template: owner=root group=root src=files/bind/bind.service dest=/etc/systemd/system/{{NAME}}.service
notify: restart service