aboutsummaryrefslogtreecommitdiffstats
path: root/roles/nsd/README.md
blob: eacbe2e710df6f89cbab342d3f7d5258ec9eac07 (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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
NSD
===

Description
-----------

The `nsd` role installs the `nsd` authoritative nameserver and generates zone
files.

Variables
---------

This role **accepts** the following variables:

Variable           | Default                         | Description
-------------------|---------------------------------|------------
`nsd_server_count` | `{{ ansible_processor_vcpus }}` | Number of server threads to run
`nsd_zones`        | `[]`                            | DNS zones to serve (see [format](#nsd_zones) below)
`nsd_default_ttl`  | 10800                           | Default record TTL (seconds)

### nsd\_zones

The `nsd_zones` variable is used to configure authoritative DNS zones to serve.
It should contain a list of dictionaries of the following format:

Key                 | Default                 | Description
--------------------|-------------------------|------------
`name`              |                    | DNS zone
`slave_nameservers` | `[]`                    | List of hosts to send notifies and allow zone transfers
`ttl`               | `{{ nsd_default_ttl }}` | Default TTL for this zone
`content`           |                    | Raw zone file content

Usage
-----

Example playbook:

````yaml
- hosts: authoritative_nameservers
  roles:
    - role: nsd
      vars:
        nsd_zones:
          - name: example.com
            slave_nameservers:
              - 203.0.113.50
              - 203.0.113.51
            ttl: 3600
            content: |
              @    IN  NS    ns1.example.com.
              @    IN  NS    ns2.example.com.
              ns1  IN  A     203.0.113.52
              ns1  IN  AAAA  2001:db8::2
              ns2  IN  A     203.0.113.53
              ns2  IN  AAAA  2001:db8::3

              @  IN  MX      10 mx1.example.com.
              @  IN  TXT     "v=spf1 mx -all"

              @           IN  A      203.0.113.54
              www1        IN  A      203.0.113.54
              mx1         IN  A      203.0.113.55
````