summaryrefslogtreecommitdiff
path: root/roles/nameservers/tasks/main.yml
blob: 96c6e7c714a7e143119e9f8e74030eb023793417 (plain)
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
---

## PRIMARY

- name: create named.conf.local for primary
  template:
    src: ../templates/named.conf.local.primary.j2
    dest: /etc/bind/named.conf.local
    owner: bind
    group: bind
  when: inventory_hostname in groups['dnsprimary']

- name: create /etc/bind/zones if not exist
  ansible.builtin.file:
    path: /etc/bind/zones
    state: directory
    owner: bind
    group: bind

- name: create primary zone files for primary
  template:
    src: "../templates/db.{{ item.zone }}.j2"
    dest: "/etc/bind/zones/db.{{ item.zone }}"
    owner: bind
    group: bind
  with_items: "{{ dns_zones }}"
  when: inventory_hostname in groups['dnsprimary']


## REPLICA

    #- name: create named.conf.local for replica
    #  template:
    #    src: ../templates/named.conf.local.replica.j2
    #    dest: /etc/bind/named.conf.local
    #    owner: bind
    #    group: bind
    #  when: inventory_hostname in groups['dnsreplica']
    #
    #- name: flush dns cache on replicas
    #  file: path={{ item }} state=absent
    #  with_fileglob: "/var/cache/bind/db.*"
    #  when: inventory_hostname in groups['dnsreplica']
    #
    #- name: restart bind9
    #  service:
    #    name: bind9
    #    state: restarted
    #    enabled: true