@@ -749,7 +749,9 @@ Master pillar: | |||
name: <tsig-key-name> | |||
reactor: | |||
dns/node/register: | |||
- salt://salt/reactor/node_ddns_register.sls | |||
- salt://salt/reactor/ddns_node_register.sls | |||
dns/static/records: | |||
- salt://salt/reactor/ddns_static_records.sls | |||
Minion pillar: | |||
@@ -761,12 +763,22 @@ Minion pillar: | |||
server: <dns-server-ip> | |||
keyname: <tsig-key-name> | |||
ttl: 300 | |||
dns_static: | |||
zone.example.com: | |||
- name: appname | |||
type: CNAME | |||
value: appserver01 | |||
Minions can be registered in DNS calling: | |||
.. code-block:: bash | |||
Manual calling: | |||
.. code-block:: bash | |||
# Minion register | |||
salt '*' state.apply salt.minion.dns_register | |||
# Static DNS records | |||
salt '*' state.apply salt.minion.dns_static | |||
Salt Minion | |||
----------- |
@@ -0,0 +1,2 @@ | |||
applications: | |||
- salt.minion.dns_static |
@@ -0,0 +1,5 @@ | |||
send_dns_static_event: | |||
event.send: | |||
- name: dns/static/records | |||
- records: {{ pillar.salt.minion.get('dns_static', {}) }} | |||
- ddns: {{ pillar.salt.minion.get('ddns', {}) }} |
@@ -13,4 +13,9 @@ include: | |||
{%- endif %} | |||
{%- if pillar.salt.minion.env_vars is defined %} | |||
- salt.minion.env_vars | |||
{%- if pillar.salt.minion.ddns is defined %} | |||
- salt.minion.dns_register | |||
{%- if pillar.salt.minion.dns_static is defined %} | |||
- salt.minion.dns_static | |||
{%- endif %} | |||
{%- endif %} |
@@ -0,0 +1,20 @@ | |||
{%- set ddns = data.data.get('ddns', {}) %} | |||
{%- for zone_name, zone in data.data.get('records', {}).iteritems() %} | |||
{%- for record in zone %} | |||
ddns_update_{{ zone_name }}_{{ loop.index }}: | |||
runner.ddns.update: | |||
- args: | |||
- zone: {{ zone_name }} | |||
- name: {{ record['name'] }} | |||
- ttl: {{ ddns.get('ttl', 300) }} | |||
- rdtype: {{ record['type'] }} | |||
- data: {{ record['value'] }} | |||
- keyname: {{ ddns.get('keyname', 'salt-updates') }} | |||
- keyfile: /etc/salt/ddns.keyring | |||
- nameserver: {{ ddns.get('server', '127.0.0.1') }} | |||
- timeout: 10 | |||
- replace: True | |||
- keyalgorithm: 'HMAC-MD5.SIG-ALG.REG.INT' | |||
{%- endfor %} | |||
{%- endfor %} |