2014-08-20 02:32:47 +02:00
|
|
|
include:
|
|
|
|
- postfix
|
|
|
|
|
2017-12-08 02:54:21 +01:00
|
|
|
{% from "postfix/map.jinja" import postfix with context %}
|
|
|
|
|
|
|
|
{{ postfix.config_dir }}:
|
2014-08-20 02:32:47 +02:00
|
|
|
file.directory:
|
2017-12-08 02:54:21 +01:00
|
|
|
- user: {{ postfix.root_user }}
|
|
|
|
- group: {{ postfix.root_group }}
|
2014-08-20 02:32:47 +02:00
|
|
|
- dir_mode: 755
|
|
|
|
- file_mode: 644
|
|
|
|
- makedirs: True
|
|
|
|
|
2017-12-08 02:54:21 +01:00
|
|
|
{{ postfix.config_dir }}/main.cf:
|
2014-08-20 02:32:47 +02:00
|
|
|
file.managed:
|
|
|
|
- source: salt://postfix/files/main.cf
|
2017-12-08 02:54:21 +01:00
|
|
|
- user: {{ postfix.root_user }}
|
|
|
|
- group: {{ postfix.root_group }}
|
2014-08-20 02:32:47 +02:00
|
|
|
- mode: 644
|
2014-08-20 03:42:08 +02:00
|
|
|
- require:
|
|
|
|
- pkg: postfix
|
2014-08-20 02:32:47 +02:00
|
|
|
- watch_in:
|
2014-08-20 03:46:15 +02:00
|
|
|
- service: postfix
|
2014-08-20 02:32:47 +02:00
|
|
|
- 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 %}
|
|
|
|
|
2015-03-26 09:43:44 +01:00
|
|
|
{% 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
|
2015-03-25 12:49:57 +01:00
|
|
|
{% endif %}
|
2015-06-20 22:49:09 +02:00
|
|
|
|
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 %}
|
|
|
|
|
2015-08-30 19:30:08 +02:00
|
|
|
{%- for domain in salt['pillar.get']('postfix:certificates', {}).keys() %}
|
|
|
|
|
|
|
|
postfix_{{ domain }}_ssl_certificate:
|
2015-06-21 01:18:55 +02:00
|
|
|
|
2015-06-20 22:49:09 +02:00
|
|
|
file.managed:
|
2017-12-08 02:54:21 +01:00
|
|
|
- name: {{ postfix.config_dir }}/ssl/{{ domain }}.crt
|
2015-08-30 19:30:08 +02:00
|
|
|
- makedirs: True
|
|
|
|
- contents_pillar: postfix:certificates:{{ domain }}:public_cert
|
2015-06-20 22:49:09 +02:00
|
|
|
- watch_in:
|
2015-08-30 19:30:08 +02:00
|
|
|
- service: postfix
|
2015-06-20 22:49:09 +02:00
|
|
|
|
2015-08-30 19:30:08 +02:00
|
|
|
postfix_{{ domain }}_ssl_key:
|
2015-06-20 22:49:09 +02:00
|
|
|
file.managed:
|
2017-12-08 02:54:21 +01:00
|
|
|
- name: {{ postfix.config_dir }}/ssl/{{ domain }}.key
|
2015-08-30 19:30:08 +02:00
|
|
|
- mode: 600
|
|
|
|
- makedirs: True
|
|
|
|
- contents_pillar: postfix:certificates:{{ domain }}:private_key
|
2015-06-20 22:49:09 +02:00
|
|
|
- watch_in:
|
2015-08-30 19:30:08 +02:00
|
|
|
- service: postfix
|
2015-06-20 22:49:09 +02:00
|
|
|
|
2015-08-30 19:30:08 +02:00
|
|
|
{% endfor %}
|