Blob Blame History Raw
include:
  - .aliases

postfix:
  pkg.installed: []
  service.running:
    - enable: True

# update main.cf
# (only update options given in profile:postfix:maincf pillar, other settings stay unchanged)
{%- for option, value in salt['pillar.get']('profile:postfix:maincf', {}).items() %}
/etc/postfix/main.cf_{{ option }}:
  file.replace:
    - name: /etc/postfix/main.cf
    - pattern: '^{{ option }} *=.*$'
    - repl: '{{ option }} = {{ value }}'
    - append_if_not_found: True
    - ignore_if_missing: {{ opts['test'] }}
    - require:
      - pkg: postfix
    - watch_in:
      - service: postfix
{%- endfor %}

# update master.cf
# (only update options given in profile:postfix:maincf pillar, other settings stay unchanged)
{%- for option, value in salt['pillar.get']('profile:postfix:mastercf', {}).items() %}
/etc/postfix/master.cf_{{ option }}:
  file.replace:
    - name: /etc/postfix/master.cf
    - pattern: '^{{ option }}\s.*$'
    - repl: '{{ option }} {{ value }}'
    - append_if_not_found: True
    - require:
      - pkg: postfix
    - watch_in:
      - service: postfix
{%- endfor %}