saltstack-formulas / powerdns-formula

http://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html
Apache License 2.0
6 stars 29 forks source link

Does not work out of the box #5

Closed syphernl closed 8 years ago

syphernl commented 10 years ago

Including powerdns in the top.sls and running highstate results in it failing to render the configuration:

----------
ID: powerdns_config
Function: file.managed
Name: /etc/powerdns/pdns.conf
Result: False
Comment: Unable to manage file: Jinja error: argument of type 'StrictUndefined' is not iterable
Traceback (most recent call last):
File "/usr/lib/pymodules/python2.7/salt/utils/templates.py", line 261, in render_jinja_tmpl
output = jinja_env.from_string(tmplstr).render(**unicode_context)
File "/usr/lib/python2.7/dist-packages/jinja2/environment.py", line 894, in render
return self.environment.handle_exception(exc_info, True)
File "<template>", line 11, in top-level template code
TypeError: argument of type 'StrictUndefined' is not iterable

; line 11

---
[...]
#################################
# allow-axfr-ips If enabled, restrict zonetransfers to originate from these
# IP addresses
#
# allow-axfr-ips=
{% if 'dns-supermaster' in grains['role'] %} <======================
allow-axfr-ips={{ pillar['networks']['dns-master']['ip'] }}
{% endif %}

#################################
# allow-recursion   List of netmasks that are allowed to recurse
[...]

---
Changes: 
costibleotu commented 10 years ago

You have to set "dns-supermaster" in minion's grains, like this:

grains: role:

You also have to define a "networks:dns-master:ip" resembling the dns master ip address.

The formula works in the following scenario: -1 hidden master (dns-supermaster) -1 master (dns-master running bind)

To formula definitely needs some love and made to be more generic, not so specific.

wwentland commented 10 years ago

@costibleotu It would definitely be much appreciated if you could work on making it more generic and ensure that the formula can be used as-is.