Merge pull request #106 from Perceptyx/reorganize-maps

refactor(maps): move tls_policy and transport maps to standard mapping
This commit is contained in:
Felipe Zipitría 2020-06-06 19:25:42 -03:00 committed by GitHub
commit 0b16a2c2cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 83 deletions

View File

@ -122,6 +122,7 @@ postfix:
local_transport: virtual
local_recipient_maps: $virtual_mailbox_maps
# Use the `mapping` key to define the map
transport_maps: hash:/etc/postfix/transport
# SMTP server
@ -163,13 +164,6 @@ postfix:
relay_recipient_maps: hash:/etc/postfix/relay_domains
virtual_alias_maps: hash:/etc/postfix/virtual
transport:
DOMAIN_NAME: ':[IP_ADDRESS]'
tls_policy:
example.com: encrypt
.example.com: encrypt
vmail:
user: postfix_user
password: DB_PASSWD
@ -234,6 +228,13 @@ postfix:
-----END RSA PRIVATE KEY-----
mapping:
transport_maps:
- DOMAIN_NAME: ':[IP_ADDRESS]'
smpt_tls_policy_maps:
- example.com: encrypt
- .example.com: encrypt
smtp_sasl_password_maps:
- smtp.example.com: myaccount:somepassword

View File

@ -80,48 +80,6 @@ include:
postfix_master_services: {{ postfix_master_services|tojson }}
{% endif %}
{% if 'transport' in pillar.get('postfix', '') %}
{{ postfix.config_path }}/transport:
file.managed:
- source: salt://postfix/files/transport
- user: root
- group: {{ postfix.root_grp }}
- mode: 644
- require:
- pkg: postfix
- watch_in:
- service: postfix
- template: jinja
run-postmap:
cmd.wait:
- name: {{ postfix.xbin_prefix }}/sbin/postmap {{ postfix.config_path }}/transport
- cwd: /
- watch:
- file: {{ postfix.config_path }}/transport
{% endif %}
{% if 'tls_policy' in pillar.get('postfix', '') %}
{{ postfix.config_path }}/tls_policy:
file.managed:
- source: salt://postfix/files/tls_policy
- user: root
- group: {{ postfix.root_grp }}
- mode: 644
- require:
- pkg: postfix
- watch_in:
- service: postfix
- template: jinja
run-postmap-tls-policy:
cmd.wait:
- name: {{ postfix.xbin_prefix }}/sbin/postmap {{ postfix.config_path }}/tls_policy
- cwd: /
- watch:
- file: {{ postfix.config_path }}/tls_policy
{% endif %}
{%- for domain in salt['pillar.get']('postfix:certificates', {}).keys() %}
postfix_{{ domain }}_ssl_certificate:

View File

@ -1,17 +0,0 @@
#
# This file is managed by salt
#
{% set config = salt['pillar.get']('postfix:tls_policy', {}) -%}
{% macro set_parameter(parameter, default=None) -%}
{% set value = config.get(parameter, default) -%}
{% if value is not none -%}
{{ parameter }} {{ value }}
{% endif -%}
{% endmacro -%}
{# Accept arbitrary parameters -#}
{% for parameter in config -%}
{{ set_parameter(parameter) }}
{% endfor -%}

View File

@ -1,17 +0,0 @@
#
# This file is managed by salt
#
{% set config = salt['pillar.get']('postfix:transport', {}) -%}
{% macro set_parameter(parameter, default=None) -%}
{% set value = config.get(parameter, default) -%}
{% if value is not none -%}
{{ parameter }} {{ value }}
{% endif -%}
{% endmacro -%}
{# Accept arbitrary parameters -#}
{% for parameter in config -%}
{{ set_parameter(parameter) }}
{% endfor -%}