๐Ÿ“— Ansible playbooks and roles for building an idempotent, interconnected and scalable infrastructure
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

48 lines
1.7 KiB

{%- macro roundcube_array_option(option) -%}
{% if option.value is string -%}
{% if option.value == 'null' -%}
'{{ option.key }}' => {{ option.value }}
{% else -%}
'{{ option.key }}' => '{{ option.value }}'
{% endif -%}
{% elif option.value is boolean -%}
'{{ option.key }}' => {{ 'true' if option.value else 'false' }}
{% elif option.value is mapping -%}
'{{ option.key }}' => [
{% for suboption in (option.value | dict2items) -%}
{{ roundcube_array_option(suboption) }}
{%- if not loop.last -%},{%- endif %}
{% endfor -%}
]
{% else -%}
'{{ option.key }}' => {{ option.value if option.value != None else '' }}
{% endif -%}
{%- endmacro -%}
{%- macro roundcube_option(option) -%}
{% if option.value is string -%}
{% if (option.key == 'syslog_facility') or (option.value == 'null') -%}
$config['{{ option.key }}'] = {{ option.value }};
{% else -%}
$config['{{ option.key }}'] = '{{ option.value }}';
{% endif -%}
{% elif option.value is boolean -%}
$config['{{ option.key }}'] = {{ 'true' if option.value else 'false' }};
{% elif option.value | type_debug == 'list' -%}
$config['{{ option.key }}'] = array(
{% for suboption in option.value -%}
'{{ suboption }}'
{%- if not loop.last -%},{%- endif %}
{% endfor -%}
);
{% elif option.value is mapping -%}
$config['{{ option.key }}'] = [
{% for suboption in (option.value | dict2items) -%}
{{ roundcube_array_option(suboption) }}
{%- if not loop.last -%},{%- endif %}
{% endfor -%}
];
{% else -%}
$config['{{ option.key }}'] = {{ option.value if option.value != None else '' }};
{% endif -%}
{%- endmacro -%}