postfix-formula/postfix/config.sls

120 lines
2.9 KiB
Plaintext
Raw Normal View History

include:
- postfix
2017-12-08 02:54:21 +01:00
{% from "postfix/map.jinja" import postfix with context %}
{{ postfix.config_dir }}:
file.directory:
2017-12-08 02:54:21 +01:00
- user: {{ postfix.root_user }}
- group: {{ postfix.root_group }}
- dir_mode: 755
- file_mode: 644
- makedirs: True
2017-12-08 02:54:21 +01:00
{{ postfix.config_dir }}/main.cf:
file.managed:
- source: salt://postfix/files/main.cf
2017-12-08 02:54:21 +01:00
- user: {{ postfix.root_user }}
- group: {{ postfix.root_group }}
- mode: 644
- require:
- pkg: postfix
- watch_in:
- service: postfix
- template: jinja
2015-06-21 01:18:55 +02:00
{% if 'vmail' in pillar.get('postfix', '') %}
2017-12-08 02:54:21 +01:00
{{ postfix.config_dir }}/virtual_alias_maps.cf:
2015-06-21 01:18:55 +02:00
file.managed:
- source: salt://postfix/files/virtual_alias_maps.cf
2017-12-08 02:54:21 +01:00
- user: {{ postfix.root_user }}
2015-06-21 01:18:55 +02:00
- group: postfix
- mode: 640
- require:
- pkg: postfix
- watch_in:
- service: postfix
- template: jinja
2017-12-08 02:54:21 +01:00
{{ postfix.config_dir }}/virtual_mailbox_domains.cf:
2015-06-21 01:18:55 +02:00
file.managed:
- source: salt://postfix/files/virtual_mailbox_domains.cf
2017-12-08 02:54:21 +01:00
- user: {{ postfix.root_user }}
2015-06-21 01:18:55 +02:00
- group: postfix
- mode: 640
- require:
- pkg: postfix
- watch_in:
- service: postfix
- template: jinja
2017-12-08 02:54:21 +01:00
{{ postfix.config_dir }}/virtual_mailbox_maps.cf:
2015-06-21 01:18:55 +02:00
file.managed:
- source: salt://postfix/files/virtual_mailbox_maps.cf
2017-12-08 02:54:21 +01:00
- user: {{ postfix.root_user }}
2015-06-21 01:18:55 +02:00
- group: postfix
- mode: 640
- require:
- pkg: postfix
- watch_in:
- service: postfix
- template: jinja
{% endif %}
{% if salt['pillar.get']('postfix:manage_master_config', True) %}
2017-12-08 02:54:21 +01:00
{{ postfix.config_dir }}/master.cf:
2015-02-05 09:57:18 +01:00
file.managed:
- source: salt://postfix/files/master.cf
2017-12-08 02:54:21 +01:00
- user: {{ postfix.root_user }}
- group: {{ postfix.root_group }}
2015-02-05 09:57:18 +01:00
- mode: 644
- require:
- pkg: postfix
- watch_in:
- service: postfix
- template: jinja
{% endif %}
2015-06-21 01:18:55 +02:00
{% if 'transport' in pillar.get('postfix', '') %}
2017-12-08 02:54:21 +01:00
{{ postfix.config_dir }}/transport:
2015-06-21 01:18:55 +02:00
file.managed:
- source: salt://postfix/files/transport
2017-12-08 02:54:21 +01:00
- user: {{ postfix.root_user }}
- group: {{ postfix.root_group }}
2015-06-21 01:18:55 +02:00
- mode: 644
- require:
- pkg: postfix
- watch_in:
- service: postfix
- template: jinja
run-postmap:
cmd.wait:
2017-12-08 02:54:21 +01:00
- name: /usr/sbin/postmap {{ postfix.config_dir }}/transport
2015-06-21 01:18:55 +02:00
- cwd: /
- watch:
2017-12-08 02:54:21 +01:00
- file: {{ postfix.config_dir }}/transport
2015-06-21 01:18:55 +02:00
{% endif %}
{%- for domain in salt['pillar.get']('postfix:certificates', {}).keys() %}
postfix_{{ domain }}_ssl_certificate:
2015-06-21 01:18:55 +02:00
file.managed:
2017-12-08 02:54:21 +01:00
- name: {{ postfix.config_dir }}/ssl/{{ domain }}.crt
- makedirs: True
- contents_pillar: postfix:certificates:{{ domain }}:public_cert
- watch_in:
- service: postfix
postfix_{{ domain }}_ssl_key:
file.managed:
2017-12-08 02:54:21 +01:00
- name: {{ postfix.config_dir }}/ssl/{{ domain }}.key
- mode: 600
- makedirs: True
- contents_pillar: postfix:certificates:{{ domain }}:private_key
- watch_in:
- service: postfix
{% endfor %}