forked from saltstack-formulas/dnsmasq-formula
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial Pillar support in dnsmasq-formula
- Loading branch information
Showing
4 changed files
with
83 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,39 @@ | ||
dnsmasq: | ||
pkg: | ||
- installed | ||
service: | ||
- running | ||
- enable: True | ||
- require: | ||
- pkg: dnsmasq | ||
- watch: | ||
- file: /etc/dnsmasq.conf | ||
- file: /etc/dnsmasq.d | ||
# Include :download:`map file <map.jinja>` of OS-specific package names and | ||
# file paths. Values can be overridden using Pillar. | ||
{% from "dnsmasq/map.jinja" import dnsmasq with context %} | ||
/etc/dnsmasq.conf: | ||
{% if salt['pillar.get']('dnsmasq:dnsmasq_conf') %} | ||
dnsmasq_conf: | ||
file.managed: | ||
- source: salt://dnsmasq/files/dnsmasq.conf | ||
- name: {{ dnsmasq.dnsmasq_conf }} | ||
- source: {{ salt['pillar.get']('dnsmasq:dnsmasq_conf', 'salt://dnsmasq/files/dnsmasq.conf') }} | ||
- user: root | ||
- group: root | ||
- mode: 644 | ||
- template: jinja | ||
- require: | ||
- pkg: dnsmasq | ||
/etc/dnsmasq.d: | ||
dnsmasq_conf_dir: | ||
file.recurse: | ||
- source: salt://dnsmasq/files/dnsmasq.d | ||
- name: {{ dnsmasq.dnsmasq_conf_dir }} | ||
- source: {{ salt['pillar.get']('dnsmasq:dnsmasq_conf_dir', 'salt://dnsmasq/files/dnsmasq.d') }} | ||
- template: jinja | ||
- require: | ||
- pkg: dnsmasq | ||
{% endif %} | ||
dnsmasq: | ||
pkg: | ||
- installed | ||
service: | ||
- running | ||
- name: {{ dnsmasq.service }} | ||
- enable: True | ||
- require: | ||
- pkg: dnsmasq | ||
{% if salt['pillar.get']('dnsmasq:dnsmasq_conf') %} | ||
- watch: | ||
- file: dnsmasq_conf | ||
- file: dnsmasq_conf_dir | ||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{% set map = { | ||
'Debian': { | ||
'service': 'dnsmasq', | ||
'dnsmasq_conf': '/etc/dnsmasq.conf', | ||
'dnsmasq_conf_dir': '/etc/dnsmasq.d', | ||
}, | ||
'RedHat': { | ||
'service': 'dnsmasq', | ||
'dnsmasq_conf': '/etc/dnsmasq.conf', | ||
'dnsmasq_conf_dir': '/etc/dnsmasq.d', | ||
}, | ||
} %} | ||
|
||
{% if grains.get('saltversion', '').startswith('0.17') %} | ||
{% set dnsmasq = salt['grains.filter_by'](map, merge=salt['pillar.get']('dnsmasq:lookup')) %} | ||
{% else %} | ||
{% set dnsmasq = map.get(grains.os_family) %} | ||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Example settings for dnsmasq. | ||
dnsmasq: | ||
dnsmasq_conf: salt://dnsmasq/files/dnsmasq.conf | ||
dnsmasq_conf_dir: salt://dnsmasq/files/dnsmasq.d | ||
|
||
# Port to listen on. Setting this to zero completely disables DNS function, | ||
# leaving only DHCP and/or TFTP. | ||
port: 53 | ||
|
||
# Require full domain name? (including a dot and domain part) | ||
domain_needed: False | ||
# Never forward addresses in the non-routed address spaces? | ||
bogus_priv: False |