Bladeren bron

Add static DNS records pushing ability.

pull/79/head
Martin Horak 6 jaren geleden
bovenliggende
commit
90acc2998e
6 gewijzigde bestanden met toevoegingen van 47 en 3 verwijderingen
  1. +15
    -3
      README.rst
  2. +2
    -0
      metadata/service/minion/dns_static.yml
  3. +5
    -0
      salt/minion/dns_static.sls
  4. +5
    -0
      salt/minion/init.sls
  5. +0
    -0
      salt/reactor/ddns_node_register.sls
  6. +20
    -0
      salt/reactor/ddns_static_records.sls

+ 15
- 3
README.rst Bestand weergeven

@@ -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
-----------

+ 2
- 0
metadata/service/minion/dns_static.yml Bestand weergeven

@@ -0,0 +1,2 @@
applications:
- salt.minion.dns_static

+ 5
- 0
salt/minion/dns_static.sls Bestand weergeven

@@ -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', {}) }}

+ 5
- 0
salt/minion/init.sls Bestand weergeven

@@ -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 %}

salt/reactor/node_ddns_register.sls → salt/reactor/ddns_node_register.sls Bestand weergeven


+ 20
- 0
salt/reactor/ddns_static_records.sls Bestand weergeven

@@ -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 %}

Laden…
Annuleren
Opslaan