formula-postfix/postfix/config.sls

118 lines
2.5 KiB
Text
Raw Normal View History

include:
- postfix
/etc/postfix:
file.directory:
- user: root
- group: root
- dir_mode: 755
- file_mode: 644
- makedirs: True
/etc/postfix/main.cf:
file.managed:
- source: salt://postfix/files/main.cf
- user: root
- group: root
- mode: 644
- require:
- pkg: postfix
- watch_in:
- service: postfix
- template: jinja
2015-06-20 19:18:55 -04:00
{% if 'vmail' in pillar.get('postfix', '') %}
/etc/postfix/virtual_alias_maps.cf:
file.managed:
- source: salt://postfix/files/virtual_alias_maps.cf
- user: root
- group: postfix
- mode: 640
- require:
- pkg: postfix
- watch_in:
- service: postfix
- template: jinja
/etc/postfix/virtual_mailbox_domains.cf:
file.managed:
- source: salt://postfix/files/virtual_mailbox_domains.cf
- user: root
- group: postfix
- mode: 640
- require:
- pkg: postfix
- watch_in:
- service: postfix
- template: jinja
/etc/postfix/virtual_mailbox_maps.cf:
file.managed:
- source: salt://postfix/files/virtual_mailbox_maps.cf
- user: root
- group: postfix
- mode: 640
- require:
- pkg: postfix
- watch_in:
- service: postfix
- template: jinja
{% endif %}
{% if salt['pillar.get']('postfix:manage_master_config', True) %}
2015-02-05 03:57:18 -05:00
/etc/postfix/master.cf:
file.managed:
- source: salt://postfix/files/master.cf
- user: root
- group: root
- mode: 644
- require:
- pkg: postfix
- watch_in:
- service: postfix
- template: jinja
{% endif %}
2015-06-20 19:18:55 -04:00
{% if 'transport' in pillar.get('postfix', '') %}
/etc/postfix/transport:
file.managed:
- source: salt://postfix/files/transport
- user: root
- group: root
- mode: 644
- require:
- pkg: postfix
- watch_in:
- service: postfix
- template: jinja
run-postmap:
cmd.wait:
- name: /usr/sbin/postmap /etc/postfix/transport
- cwd: /
- watch:
- file: /etc/postfix/transport
{% endif %}
{%- for domain in salt['pillar.get']('postfix:certificates', {}).keys() %}
postfix_{{ domain }}_ssl_certificate:
2015-06-20 19:18:55 -04:00
file.managed:
- name: /etc/postfix/ssl/{{ domain }}.crt
- makedirs: True
- contents_pillar: postfix:certificates:{{ domain }}:public_cert
- watch_in:
- service: postfix
postfix_{{ domain }}_ssl_key:
file.managed:
- name: /etc/postfix/ssl/{{ domain }}.key
- mode: 600
- makedirs: True
- contents_pillar: postfix:certificates:{{ domain }}:private_key
- watch_in:
- service: postfix
{% endfor %}