Initial commit
This commit is contained in:
commit
fcbc90c89c
4 changed files with 72 additions and 0 deletions
36
templates/unbound.conf.j2
Normal file
36
templates/unbound.conf.j2
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
#jinja2: lstrip_blocks: True
|
||||
{% macro clause_attr(key, value) %}
|
||||
{% if value is boolean %}
|
||||
{{ key }}: {{ 'yes' if value else 'no' }}
|
||||
{% elif value is iterable and not value is string %}
|
||||
{% for item in value %}
|
||||
{{ key }}: {{ item }}
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
{{ key }}: {{ value }}
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
|
||||
{% if unbound_config_include_conf_d %}
|
||||
include-toplevel: "/etc/unbound/unbound.conf.d/*.conf"
|
||||
{% endif %}
|
||||
|
||||
{% for clause, clause_items in unbound_config.items() %}
|
||||
{% if clause_items.values()|reject('mapping')|length != 0 %}
|
||||
{{ clause }}:
|
||||
{% for key, value in clause_items.items() %}
|
||||
{{ clause_attr(key, value) }}
|
||||
{%- endfor %}
|
||||
|
||||
{% else %}
|
||||
{% for clause_key, clause_instance_items in clause_items.items() %}
|
||||
{{ clause }}:
|
||||
name: "{{ clause_key }}"
|
||||
{% for key, value in clause_instance_items.items() %}
|
||||
{{ clause_attr(key, value) }}
|
||||
{%- endfor %}
|
||||
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{{ unbound_config_raw }}
|
||||
Loading…
Add table
Add a link
Reference in a new issue