@@ -0,0 +1,6 @@ | |||
{%- from "salt/map.jinja" import master with context -%} | |||
{ | |||
{%- for key in master.ddns.get('keys', []) %} | |||
"{{ key.name }}.": "{{ key.key }}"{{ "," if not loop.last else "" }} | |||
{%- endfor %} | |||
} |
@@ -1,14 +1,13 @@ | |||
{%- from "salt/map.jinja" import master with context %} | |||
{%- if master.get('ddns:server', False) %} | |||
ddns_registrator_packages: | |||
{%- if master.get('ddns', {}).get('enabled', False) %} | |||
ddns_packages: | |||
pkg.installed: | |||
- names: {{ master:ddns_pkgs }} | |||
- names: {{ master.ddns_pkgs }} | |||
ddns_keys_file: | |||
file.managed: | |||
- name: /etc/salt/ddns.keyring | |||
- source: salt://salt/files/ddns.keys | |||
- source: salt://salt/files/ddns.keyring | |||
- template: jinja | |||
- mode: 600 | |||
@@ -4,7 +4,7 @@ include: | |||
- salt.master.reactor | |||
{%- endif %} | |||
{%- if pillar.salt.master.ddns is defined %} | |||
- salt.master.ddns_registrator | |||
- salt.master.ddns | |||
{%- endif %} | |||
- salt.master.env | |||
- salt.master.pillar |
@@ -2,3 +2,4 @@ send_dns_register_event: | |||
event.send: | |||
- name: dns/node/register | |||
- net_info: {{ pillar.linux.network.get('host', {}) }} | |||
- ddns: {{ pillar.salt.minion.get('ddns', {}) }} |
@@ -1,3 +1,4 @@ | |||
{%- set ddns = data.data.get('ddns', {}) %} | |||
{%- for rec_name, record in data.data.get('net_info', {}).iteritems() %} | |||
{%- for name in record.get('names', []) if '.' in name %} | |||
{%- set hostname, domain = name.split('.',1) %} | |||
@@ -7,11 +8,12 @@ ddns_node_register_{{ name }}_{{ loop.index }}: | |||
- args: | |||
- zone: {{ domain }} | |||
- name: {{ hostname }} | |||
- ttl: 300 | |||
- ttl: {{ ddns.get('ttl', 300) }} | |||
- ip: {{ record.get('address', '127.0.0.127') }} | |||
- keyname: salt-updates | |||
- keyfile: /etc/salt/dns.keyring | |||
- nameserver: {{ salt['grains.get']('ddns_server', '127.0.0.1') }} | |||
- keyname: {{ ddns.get('keyname', 'salt-updates') }} | |||
- keyfile: /etc/salt/ddns.keyring | |||
- nameserver: {{ ddns.get('server', '127.0.0.1') }} | |||
- keyalgorithm: 'HMAC-MD5.SIG-ALG.REG.INT' | |||
- timeout: 10 | |||
{%- endfor %} | |||
{%- endfor %} |