/
tinyproxy.conf.j2
54 lines (52 loc) · 2.07 KB
/
tinyproxy.conf.j2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# {{ ansible_managed }}
##
## tinyproxy.conf -- tinyproxy daemon configuration file
##
{% for item in tinyproxy__combined_configuration | parse_kv_items %}
{% if item.comment|d() %}
{{ item.comment | regex_replace('\n$','') | comment() }}
{% endif %}
{% if item.options|d() %}
{% for element in item.options %}
{% if element is string %}
{% if not loop.first %}
{% endif %}
{{ "{}".format(element) }}
{% elif element is mapping %}
{% if element.name|d() %}
{% if element.state|d('present') not in [ 'absent', 'ignore' ] %}
{% if (loop.first and item.comment|d() and element.comment|d()) or (not loop.first and (element.comment|d() or (element.separator|d())|bool)) %}
{% endif %}
{% if element.comment|d() %}
{{ element.comment | regex_replace('\n$','') | comment() }}
{% endif %}
{% if element.value|d() %}
{% if element.value is string %}
{{ "{}{} = {}".format(('#' if (element.state|d('present') == 'comment') else ''), element.option | d(element.name), element.value) }}
{% else %}
{% for thing in (element.value | selectattr('state', 'equalto', 'present') | map(attribute='name') | list) %}
{{ "{}{} = {}".format(('#' if (element.state|d('present') == 'comment') else ''), element.option | d(element.name), thing) }}
{% endfor %}
{% endif %}
{% elif element.raw|d() %}
{% if element.state|d('present') == 'comment' %}
{{ "{}".format(element.raw | regex_replace('\n$','')) | comment() }}
{% else %}
{{ "{}".format(element.raw | regex_replace('\n$','')) }}
{% endif %}
{% else %}
{{ "{}{}".format(('#' if (element.state|d('present') == 'comment') else ''), element.option | d(element.name)) }}
{% endif %}
{% endif %}
{% else %}
{% for key, value in element.items() %}
{{ "{} = {}".format(key, value) }}
{% endfor %}
{% endif %}
{% endif %}
{% endfor %}
{% endif %}
{% if item.raw|d() %}
{{ item.raw | regex_replace('\n$','') }}
{% endif %}
{% endfor %}