| | |
| |**NOTE:** Setting to "yes" will add ``allow-recursion { any; }``. See To-Do. |
+--------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------+
+|``ddns_keys: {}`` |A dictionary defining each Dynamic DNS zone's authorized key. See **Dynamic DNS** below. Defined in an encrypted file in |
+| |the secrets repo |
++--------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------+
**named_domains: []**
ddns.example.com:
ipvar: NULL
dynamic: true
+ forward: ddns.example.com
Inventory
+++++++++
**Note:** Hosts in inventory with no IP address defined will not have records created and should be added to ``miscrecords`` in ``named_domains``.
+Dynamic DNS
++++++++++++
+If you wish to use the Dynamic DNS feature of this role, you should generate an HMAC-MD5 keypair using dnssec-keygen_ for each zone you want to be able to dynamically update. The key generated should be pasted in the ``secret`` value of the ``ddns_keys`` dictionary for the corresponding domain.
+
+**Example**::
+
+ $ dnssec-keygen -a HMAC-MD5 -b 512 -n USER ddns.example.com
+ Kddns.example.com.+157+57501
+ $ cat Kddns.example.com.+157+57501.key
+ ddns.example.com. IN KEY 0 3 157 LxFSAiBgKYtsTTV/hjaK7LNdsbk19xQv0ZY9xLtrpdIWhf2S4gurD5GJ JjP9N8bnlCPKc7zVy+JcBYbSMSsm2A==
+
+ # In {{ secrets_path }}/nameserver.yml
+ ---
+ ddns_keys:
+ ddns.example.com:
+ secret: "LxFSAiBgKYtsTTV/hjaK7LNdsbk19xQv0ZY9xLtrpdIWhf2S4gurD5GJ JjP9N8bnlCPKc7zVy+JcBYbSMSsm2A=="
+
+``roles/nameserver/templates/named.conf.j2`` loops through each domain in ``named_domains``, checks whether ``dynamic: true`` and if so, then loops through ``ddns_keys`` and matches the secret key to the domain.
+
+These instructions assume you'll either have one host updating DNS records or you'll be sharing the resulting key. Clients can use nsupdate_ to update the nameserver. Configuring that is outside the scope of this role.
+
+You can have two types of Dynamic DNS zones:
+
+ 1. A pure dynamic DNS zone with no static A records
+ 2. A mixed zone consisting of both dynamic and static records
+
+For a mixed zone, you must specify ``ddns_hostname_prefixes`` under the domain in ``named_domains`` else your dynamic records will be overwritten each time the records task is run. **Example**::
+
+ named_domains:
+ private.example.com:
+ forward: private.example.com
+ ipvar: ip
+ dynamic: true
+ ddns_hostname_prefixes:
+ - foo
+ ddns.example.com:
+ forward: ddns.example.com
+ ipvar: NULL
+ dynamic: true
+
+In the example above, a dynamic hostname of ``foo001.private.example.com`` will be saved and restored at the end of the records task. If you *dynamically* added a hostname of ``bar001.private.example.com`` however, the records task will remove it. Do not create static hostnames in your ansible inventory using any of the prefixes in ``ddns_hostname_prefixes`` or you'll end up with duplicates in the zone file.
+
+The records task will not modify the ddns.example.com zone file.
+
+For our upstream test lab's purposes, this allows us to combine static and dynamic records in our ``front.sepia.ceph.com`` domain so teuthology_'s ``lab_domain`` variable can remain unchanged.
+
+**NOTE:** Reverse zone Dynamic DNS is not supported at this time.
+
Tags
++++
- Allow additional user-defined firewall rules
- DNSSEC
-- Dynamic DNS
- Add support for specifying networks to allow recursion from
.. _Sepia: https://ceph.github.io/sepia/
+.. _dnssec-keygen: https://ftp.isc.org/isc/bind9/cur/9.9/doc/arm/man.dnssec-keygen.html
+.. _nsupdate: https://linux.die.net/man/8/nsupdate
+.. _teuthology: http://docs.ceph.com/teuthology/docs/siteconfig.html?highlight=lab_domain
};
};
+# Dynamic DNS
+{% for key, zone in named_domains.iteritems() %}
+{% if zone.dynamic == true %}
+{% for domain, values in ddns_keys.iteritems() %}
+{% if key == domain %}
+key "{{ key }}" {
+ algorithm hmac-md5;
+ secret "{{ values.secret }}";
+};
+{% endif %}
+{% endfor %}
+{% endif %}
+{% endfor %}
+
# Forward zones
{% for key, zone in named_domains.iteritems() %}
zone "{{ key }}" {
type master;
file "{{ named_conf_zones_path }}/{{ key }}";
+{% if zone.dynamic == true %}
+ allow-update { key "{{ key }}"; };
+{% endif %}
};
{% endfor %}