{%- 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 %} | |||||
} |
{%- from "salt/map.jinja" import master with context %} | {%- 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: | pkg.installed: | ||||
- names: {{ master:ddns_pkgs }} | |||||
- names: {{ master.ddns_pkgs }} | |||||
ddns_keys_file: | ddns_keys_file: | ||||
file.managed: | file.managed: | ||||
- name: /etc/salt/ddns.keyring | - name: /etc/salt/ddns.keyring | ||||
- source: salt://salt/files/ddns.keys | |||||
- source: salt://salt/files/ddns.keyring | |||||
- template: jinja | - template: jinja | ||||
- mode: 600 | - mode: 600 | ||||
- salt.master.reactor | - salt.master.reactor | ||||
{%- endif %} | {%- endif %} | ||||
{%- if pillar.salt.master.ddns is defined %} | {%- if pillar.salt.master.ddns is defined %} | ||||
- salt.master.ddns_registrator | |||||
- salt.master.ddns | |||||
{%- endif %} | {%- endif %} | ||||
- salt.master.env | - salt.master.env | ||||
- salt.master.pillar | - salt.master.pillar |
event.send: | event.send: | ||||
- name: dns/node/register | - name: dns/node/register | ||||
- net_info: {{ pillar.linux.network.get('host', {}) }} | - net_info: {{ pillar.linux.network.get('host', {}) }} | ||||
- ddns: {{ pillar.salt.minion.get('ddns', {}) }} |
{%- set ddns = data.data.get('ddns', {}) %} | |||||
{%- for rec_name, record in data.data.get('net_info', {}).iteritems() %} | {%- for rec_name, record in data.data.get('net_info', {}).iteritems() %} | ||||
{%- for name in record.get('names', []) if '.' in name %} | {%- for name in record.get('names', []) if '.' in name %} | ||||
{%- set hostname, domain = name.split('.',1) %} | {%- set hostname, domain = name.split('.',1) %} | ||||
- args: | - args: | ||||
- zone: {{ domain }} | - zone: {{ domain }} | ||||
- name: {{ hostname }} | - name: {{ hostname }} | ||||
- ttl: 300 | |||||
- ttl: {{ ddns.get('ttl', 300) }} | |||||
- ip: {{ record.get('address', '127.0.0.127') }} | - 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' | - keyalgorithm: 'HMAC-MD5.SIG-ALG.REG.INT' | ||||
- timeout: 10 | |||||
{%- endfor %} | {%- endfor %} | ||||
{%- endfor %} | {%- endfor %} |