๐Ÿ“— 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.
 
 
ansible-playbooks/roles/postfix/templates/master.j2

28 lines
1.2 KiB

{% macro postfix_service(service) -%}
{% set conf = service.conf if service.conf is mapping else {} -%}
{{ [
service.service,
"\t",
('unix' if (conf.type is not defined) else conf.type),
('-' if (conf.priv is not defined) else ('y' if conf.priv else 'n')),
('-' if (conf.unpriv is not defined) else ('y' if conf.unpriv else 'n')),
('n' if (conf.chroot is not defined) else ('y' if conf.chroot else 'n')),
('-' if (conf.wakeup is not defined) else (conf.wakeup | string)),
('-' if (conf.maxproc is not defined) else (conf.maxproc | string)),
service.command
] | select() | list | join("\t") }}
{% for option in (service.options | d({}) | dict2items) -%}
{% if option.value is boolean -%}
{{ "\t" ~ '-o ' ~ option.key ~ '=' ~ ('yes' if option.value else 'no') }}
{% elif option.value | type_debug == 'list' -%}
{{ "\t" ~ '-o ' ~ option.key ~ '=' ~ (option.value | map('quote') | join(',')) }}
{% else -%}
{{ "\t" ~ '-o ' ~ option.key ~ '=' ~ (option.value if option.value != None else '') }}
{% endif -%}
{% endfor -%}
{% endmacro -%}
{% for service in (postfix_services | d([])) -%}
{{- postfix_service(service) }}
{%- endfor %}