{% import 'globals.jinja' as globals %} include: - firewall.public.smtp - firewall.public.submission /etc/mailname: file.managed: - contents: {{ globals.public_fqdn }} postfix: debconf.set: - data: 'postfix/main_mailer_type': type: select value: Internet Site 'postfix/mailname': type: select value: {{ globals.public_fqdn }} 'postfix/destinations': type: select value: $myhostname, {{ grains['id'] }}, localhost.localdomain, localhost pkg.installed: - pkgs: - postfix - postfix-mysql - require: - file: /etc/mailname - debconf: postfix service.running: - watch: - pkg: postfix {% for file in [ 'main.cf', 'master.cf', ] %} /etc/postfix/{{ file }}: file.managed: - source: salt://vmail/files/{{ grains['osfinger'] }}/postfix/{{ file }} - template: jinja - require: - pkg: postfix - watch_in: - service: postfix {% endfor %} {% for file in [ 'mysql-virtual-alias-maps.cf', 'mysql-virtual-mailbox-domains.cf', 'mysql-virtual-mailbox-maps.cf', ] %} /etc/postfix/{{ file }}: file.managed: - source: salt://vmail/files/postfix/{{ file }} - template: jinja - context: db_host: {{ pillar['vmail']['db_host'] }} db_name: {{ pillar['vmail']['db_name'] }} db_user: {{ pillar['vmail']['db_user'] }} db_password: {{ pillar['vmail']['db_password'] }} - mode: 600 - require: - pkg: postfix - watch_in: - service: postfix {% endfor %}