Clone shirenn's configuration
This commit is contained in:
6
roles/bind/handlers/main.yml
Normal file
6
roles/bind/handlers/main.yml
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
|
||||
- name: Restart bind
|
||||
service:
|
||||
name: bind9
|
||||
state: restarted
|
23
roles/bind/tasks/main.yml
Normal file
23
roles/bind/tasks/main.yml
Normal file
@ -0,0 +1,23 @@
|
||||
---
|
||||
|
||||
- name: Queries apt to install bind9
|
||||
apt:
|
||||
name:
|
||||
- bind9
|
||||
register: pkg_result
|
||||
retries: 3
|
||||
until: pkg_result is succeeded
|
||||
notify: Restart bind
|
||||
|
||||
- name: Deploy named local configuration
|
||||
template:
|
||||
src: 'named.conf.local.j2'
|
||||
dest: '/etc/bind/named.conf.local'
|
||||
notify: Restart bind
|
||||
|
||||
- name: Deploy per-site configuration
|
||||
template:
|
||||
src: 'db.j2'
|
||||
dest: '/var/lib/bind/{{ item.name }}/db'
|
||||
with_items: '{{ bind.domains }}'
|
||||
notify: Restart bind
|
21
roles/bind/templates/db.j2
Normal file
21
roles/bind/templates/db.j2
Normal file
@ -0,0 +1,21 @@
|
||||
$TTL 3600
|
||||
@ IN SOA dns {{ item.administrator }}. (
|
||||
{{ '%Y%m%d%H' | strftime }} ;Serial
|
||||
3600 ;Refresh
|
||||
1800 ;Retry
|
||||
3600000 ;Expire
|
||||
172800 ;Minimum
|
||||
)
|
||||
|
||||
{{ item.name }}. IN NS dns
|
||||
{{ item.name }}. IN NS slave
|
||||
{{ item.name }}. IN A {{ item.ipv4 }}
|
||||
{{ item.name }}. IN AAAA {{ item.ipv6 }}
|
||||
|
||||
dns IN A {{ item.ipv4 }}
|
||||
dns IN AAAA {{ item.ipv6 }}
|
||||
slave IN A {{ item.slave }}
|
||||
|
||||
{% for alias in item.aliases %}
|
||||
{{ alias }} IN CNAME @
|
||||
{% endfor %}
|
16
roles/bind/templates/named.conf.local.j2
Normal file
16
roles/bind/templates/named.conf.local.j2
Normal file
@ -0,0 +1,16 @@
|
||||
//
|
||||
// Do any local configuration here
|
||||
//
|
||||
|
||||
// Consider adding the 1918 zones here, if they are not used in your
|
||||
// organization
|
||||
//include "/etc/bind/zones.rfc1918";
|
||||
|
||||
{% for domain in bind.domains %}
|
||||
zone "{{ domain.name }}" {
|
||||
type master;
|
||||
file "/var/lib/bind/{{ domain.name }}/db";
|
||||
notify yes;
|
||||
allow-transfer { {{ domain.slave }}; };
|
||||
};
|
||||
{% endfor %}
|
Reference in New Issue
Block a user