Skip to content

Instantly share code, notes, and snippets.

@abraithwaite
Created October 26, 2014 23:03
Show Gist options
  • Save abraithwaite/5e5daae2ec70f5a3312a to your computer and use it in GitHub Desktop.
Save abraithwaite/5e5daae2ec70f5a3312a to your computer and use it in GitHub Desktop.
Bind Zone File in Saltstack
/etc/bind/db.salt.example.com:
file.managed:
- source: salt://templates/db.salt.example.com.pyt
- template: jinja
- user: root
- group: bind
- mode: 644
bind_reload:
service.running:
- name: bind9
- watch:
- file: /etc/bind/db.salt.example.com
$ORIGIN salt.example.com.
$TTL 60 ; 1 minute
{% set serial = salt['cmd.run']('date +%Y%m%d%H') %}
@ IN SOA ns1.salt.example.com. root.salt.example.com. (
{{ serial }} ; serial
604800 ; refresh (1 week)
86400 ; retry (1 day)
2419200 ; expire (4 weeks)
604800 ; minimum (1 week)
)
@ NS ns1.salt.example.com.
@ NS ns2.salt.example.com.
{% for host, grains in salt['mine.get']('*', 'grains.items').items() %}{{ grains['host'] }} A {{ grains['ip_interfaces']['eth0'][0] }}
{% endfor %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment