--- {%- from "dovecot/map.jinja" import dovecot with context %} dovecot-imap-user: user.present: - name: {{ dovecot.imap_user }} - uid: {{ dovecot.imap_user_id }} dovecot-log-dir: file.directory: - name: /var/log/dovecot - user: dovecot - group: dovecot {%- for name, config in dovecot.config.main.items() %} dovecot-config-main-{{ name }}: file.managed: - name: {{ dovecot.config_dir }}/{{ name }} - source: salt://dovecot/templates/config.j2 - template: jinja - user: root - group: root - watch_in: - service: dovecot-service - context: config: {{ config }} {%- endfor %} {%- for name, config in dovecot.config.confd.items() %} dovecot-config-conf.d-{{ name }}: file.managed: - name: {{ dovecot.config_dir }}/conf.d/{{ name }} - source: salt://dovecot/templates/config.j2 - template: jinja - user: root - group: root - watch_in: - service: dovecot-service - context: config: {{ config }} {%- endfor %} dovecot-sieve-dir: file.directory: - name: {{ dovecot.sieve_dir }} {%- if dovecot.sieve_configfiles %} {%- for configfile in dovecot.sieve_configfiles %} dovecot-sieve-configfile-{{ configfile }}: file.managed: - name: {{ dovecot.sieve_dir }}/{{ configfile }} - mode: '0755' - source: salt://dovecot/templates/{{ configfile }}.j2 - template: jinja {%- endfor %} {%- endif %} dovecot-sieve-refresh: cmd.run: - name: "{{ dovecot.sieve_dir }}/update_sieve.sh" - cwd: {{ dovecot.sieve_dir }}