Commit 982930af authored by nimrod's avatar nimrod
Browse files

- Split handling of configuration under the server block and blocks that can

  be declared multiple times (prevents configuration errors in certain cases).
- Make the mail alias optional and configurable.
parent 61db7f42
Loading
Loading
Loading
Loading
+9 −5
Original line number Diff line number Diff line
NSD
###

Install NSD with minimal configuration. Just package installation, create
configuration and zones directories and copy templates (if any). Configuration
templates can be placed inside :code:`templates/nsd/conf.d` and zone templates
inside :code:`templates/nsd/zones` either inside the role or relative to the
playbook.
Provision NSD authorative DNS server. By default the role has minimal
configuration. You can add your own by overriding the default
:code:`nsd_config` dictionary with your own for configuration under the
:code:`server` block in :code:`nsd.conf`. For other blocks that can declared
multiple times (like the :code:`zone` block) add your own templates in the
:code:`templates/nsd/conf.d` directory either inside the role or next to your
playbook. Likewise, zone templates can be added by placing them in
:code:`templates/nsd/zones` (again either inside the role or relative to your
playbook).

Requirements
------------
+5 −4
Original line number Diff line number Diff line
---
# defaults file for ansible-role-nsd

nsd_ratelimit_qps: 200 # Limit rate of requests/second.
nsd_whitelist_ratelimit_qps: 2000 # Limit rate of requests/seconds from
                                  # whitelisted addresses.
nsd_whitelist: []
nsd_mail_alias: root # Where to send mail for the NSD user.
nsd_config: # key/value configuration under the server block, for more
            # information consult the nsd.conf man page.
    nsd_ratelimit_qps: 200
    nsd_whitelist_ratelimit_qps: 2000
+12 −1
Original line number Diff line number Diff line
@@ -29,6 +29,16 @@
  notify:
      - Restart NSD

- name: Configure
  with_dict: '{{ nsd_config }}'
  lineinfile:
      dest: '{{ nsd_conf }}'
      line: '{{ item.key }}: {{ item.value }}'
      regexp: '{{ item.key }}:'
      insertafter: 'server:'
  notify:
      - Restart NSD

- name: Copy configuration templates
  with_fileglob:
      - templates/nsd/conf.d/*
@@ -56,10 +66,11 @@
      - Restart NSD

- name: Alias emails to root
  when: nsd_mail_alias is defined
  lineinfile:
      dest: '{{ aliases_file[ansible_os_family] }}'
      create: yes
      line: '{{ nsd_user[ansible_os_family] }}: root'
      line: '{{ nsd_user[ansible_os_family] }}: {{ nsd_mail_alias }}'
      regexp: '{{ nsd_user[ansible_os_family] }}:'
  notify:
      - Update SMTPd database
+0 −7
Original line number Diff line number Diff line
rrl-ratelimit: {{ nsd_ratelimit_qps }}
rrl-whitelist-ratelimit: {{ nsd_whitelist_ratelimit_qps }}
{% if nsd_whitelist is iterable %}
{% for rrl in nsd_whitelist %}
rrl-whitelist: {{ rrl }}
{% endfor %}
{% endif %}