Template paths and groups to make them work on FreeBSD, too.

This commit is contained in:
Florian Ermisch 2017-08-24 13:02:46 +02:00 committed by Wurzel Kollektiv
parent af5e9f8862
commit 099d84ab73
3 changed files with 20 additions and 19 deletions

View File

@ -1,19 +1,20 @@
{% from "postfix/map.jinja" import postfix with context %}
include: include:
- postfix - postfix
/etc/postfix: {{ postfix.config_path }}:
file.directory: file.directory:
- user: root - user: root
- group: root - group: {{ postfix.root_grp }}
- dir_mode: 755 - dir_mode: 755
- file_mode: 644 - file_mode: 644
- makedirs: True - makedirs: True
/etc/postfix/main.cf: {{ postfix.config_path }}/main.cf:
file.managed: file.managed:
- source: salt://postfix/files/main.cf - source: salt://postfix/files/main.cf
- user: root - user: root
- group: root - group: {{ postfix.root_grp }}
- mode: 644 - mode: 644
- require: - require:
- pkg: postfix - pkg: postfix
@ -22,7 +23,7 @@ include:
- template: jinja - template: jinja
{% if 'vmail' in pillar.get('postfix', '') %} {% if 'vmail' in pillar.get('postfix', '') %}
/etc/postfix/virtual_alias_maps.cf: {{ postfix.config_path }}/virtual_alias_maps.cf:
file.managed: file.managed:
- source: salt://postfix/files/virtual_alias_maps.cf - source: salt://postfix/files/virtual_alias_maps.cf
- user: root - user: root
@ -34,7 +35,7 @@ include:
- service: postfix - service: postfix
- template: jinja - template: jinja
/etc/postfix/virtual_mailbox_domains.cf: {{ postfix.config_path }}/virtual_mailbox_domains.cf:
file.managed: file.managed:
- source: salt://postfix/files/virtual_mailbox_domains.cf - source: salt://postfix/files/virtual_mailbox_domains.cf
- user: root - user: root
@ -46,7 +47,7 @@ include:
- service: postfix - service: postfix
- template: jinja - template: jinja
/etc/postfix/virtual_mailbox_maps.cf: {{ postfix.config_path }}/virtual_mailbox_maps.cf:
file.managed: file.managed:
- source: salt://postfix/files/virtual_mailbox_maps.cf - source: salt://postfix/files/virtual_mailbox_maps.cf
- user: root - user: root
@ -60,11 +61,11 @@ include:
{% endif %} {% endif %}
{% if salt['pillar.get']('postfix:manage_master_config', True) %} {% if salt['pillar.get']('postfix:manage_master_config', True) %}
/etc/postfix/master.cf: {{ postfix.config_path }}/master.cf:
file.managed: file.managed:
- source: salt://postfix/files/master.cf - source: salt://postfix/files/master.cf
- user: root - user: root
- group: root - group: {{ postfix.root_grp }}
- mode: 644 - mode: 644
- require: - require:
- pkg: postfix - pkg: postfix
@ -74,11 +75,11 @@ include:
{% endif %} {% endif %}
{% if 'transport' in pillar.get('postfix', '') %} {% if 'transport' in pillar.get('postfix', '') %}
/etc/postfix/transport: {{ postfix.config_path }}/transport:
file.managed: file.managed:
- source: salt://postfix/files/transport - source: salt://postfix/files/transport
- user: root - user: root
- group: root - group: {{ postfix.root_grp }}
- mode: 644 - mode: 644
- require: - require:
- pkg: postfix - pkg: postfix
@ -88,10 +89,10 @@ include:
run-postmap: run-postmap:
cmd.wait: cmd.wait:
- name: /usr/sbin/postmap /etc/postfix/transport - name: {{ postfix.xbin_prefix }}/sbin/postmap {{ postfix.config_path }}/transport
- cwd: / - cwd: /
- watch: - watch:
- file: /etc/postfix/transport - file: {{ postfix.config_path }}/transport
{% endif %} {% endif %}
{%- for domain in salt['pillar.get']('postfix:certificates', {}).keys() %} {%- for domain in salt['pillar.get']('postfix:certificates', {}).keys() %}
@ -99,7 +100,7 @@ run-postmap:
postfix_{{ domain }}_ssl_certificate: postfix_{{ domain }}_ssl_certificate:
file.managed: file.managed:
- name: /etc/postfix/ssl/{{ domain }}.crt - name: {{ postfix.config_path }}/ssl/{{ domain }}.crt
- makedirs: True - makedirs: True
- contents_pillar: postfix:certificates:{{ domain }}:public_cert - contents_pillar: postfix:certificates:{{ domain }}:public_cert
- watch_in: - watch_in:
@ -107,7 +108,7 @@ postfix_{{ domain }}_ssl_certificate:
postfix_{{ domain }}_ssl_key: postfix_{{ domain }}_ssl_key:
file.managed: file.managed:
- name: /etc/postfix/ssl/{{ domain }}.key - name: {{ postfix.config_path }}/ssl/{{ domain }}.key
- mode: 600 - mode: 600
- makedirs: True - makedirs: True
- contents_pillar: postfix:certificates:{{ domain }}:private_key - contents_pillar: postfix:certificates:{{ domain }}:private_key

View File

@ -133,5 +133,5 @@ scache unix - - n - 1 scache
# ${nexthop} ${user} # ${nexthop} ${user}
{% if salt['pillar.get']('postfix:policyd-spf:enabled', False) %} {% if salt['pillar.get']('postfix:policyd-spf:enabled', False) %}
policy-spf unix - n n - - spawn policy-spf unix - n n - - spawn
user=nobody argv=/usr/bin/policyd-spf user=nobody argv={{ xbin_prefix }}/bin/policyd-spf
{%- endif %} {%- endif %}

View File

@ -33,7 +33,7 @@ postfix_alias_database:
- name: {{ file_path }} - name: {{ file_path }}
- source: salt://postfix/aliases - source: salt://postfix/aliases
- user: root - user: root
- group: root - group: {{ postfix.root_grp }}
- mode: 644 - mode: 644
- template: jinja - template: jinja
- require: - require:
@ -77,7 +77,7 @@ postfix_{{ mapping }}:
- name: {{ file_path }} - name: {{ file_path }}
- source: salt://postfix/files/mapping.j2 - source: salt://postfix/files/mapping.j2
- user: root - user: root
- group: root - group: {{ postfix.root_grp }}
{%- if mapping.endswith('_sasl_password_maps') %} {%- if mapping.endswith('_sasl_password_maps') %}
- mode: 600 - mode: 600
{%- else %} {%- else %}
@ -90,7 +90,7 @@ postfix_{{ mapping }}:
- pkg: postfix - pkg: postfix
{%- if need_postmap %} {%- if need_postmap %}
cmd.wait: cmd.wait:
- name: /usr/sbin/postmap {{ file_path }} - name: {{ postfix.xbin_prefix }}/sbin/postmap {{ file_path }}
- cwd: / - cwd: /
- watch: - watch:
- file: {{ file_path }} - file: {{ file_path }}