diff --git a/roles/mail/handlers/main.yml b/roles/mail/handlers/main.yml index e43a98b..15e6bd6 100644 --- a/roles/mail/handlers/main.yml +++ b/roles/mail/handlers/main.yml @@ -11,3 +11,12 @@ - name: Restart postgrey service: name=postgrey state=restarted + +- name: Run postmap + command: postmap /etc/{{ item }} + with_items: + - postfix/helo_access + - postfix/ldap-aliases.cf + - postfix/ldap-virtual-maps.cf + - postfix/recipient_access + - postfix/virtual-alias diff --git a/roles/mail/tasks/main.yml b/roles/mail/tasks/main.yml index a726b67..f29725b 100644 --- a/roles/mail/tasks/main.yml +++ b/roles/mail/tasks/main.yml @@ -60,17 +60,23 @@ file: path=/etc/postfix/ssl state=directory mode=0750 owner=postfix group=postfix tags: mail -# TODO run postmap - name: Configure postfix + template: src={{ item }}.j2 dest=/etc/{{ item }} + with_items: + - postfix/main.cf + - postfix/master.cf + notify: Restart postfix + tags: mail + +- name: Configure postfix maps template: src={{ item }}.j2 dest=/etc/{{ item }} with_items: - postfix/helo_access - postfix/ldap-aliases.cf - postfix/ldap-virtual-maps.cf - - postfix/main.cf - - postfix/master.cf - postfix/recipient_access - notify: Restart postfix + - postfix/virtual-alias + notify: Run postmap tags: mail - name: Create razor directory structure diff --git a/roles/mail/templates/postfix/main.cf.j2 b/roles/mail/templates/postfix/main.cf.j2 index 6e4e5c3..80c4880 100644 --- a/roles/mail/templates/postfix/main.cf.j2 +++ b/roles/mail/templates/postfix/main.cf.j2 @@ -1,9 +1,5 @@ # See /usr/share/postfix/main.cf.dist for a commented, more complete version -# Debian specific: Specifying a file name will cause the first -# line of that file to be used as the name. The Debian default -# is /etc/mailname. - smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU) biff = no @@ -78,10 +74,9 @@ content_filter = amavis:[127.0.0.1]:10024 receive_override_options = no_address_mappings virtual_mailbox_domains = {{ mail_domain }} -virtual_mailbox_maps = hash:/etc/postfix/virtual_mailbox -virtual_alias_maps = hash:/etc/postfix/virtual_alias -#virtual_mailbox_maps = ldap:/etc/postfix/ldap-virtual-maps.cf -#virtual_alias_maps = hash:/var/lib/mailman/data/virtual-mailman, hash:/etc/postfix/virtual, ldap:/etc/postfix/ldap-aliases.cf +virtual_mailbox_maps = ldap:/etc/postfix/ldap-virtual-maps.cf +virtual_alias_maps = hash:/etc/postfix/virtual-alias, ldap:/etc/postfix/ldap-aliases.cf +#virtual_alias_maps = hash:/var/lib/mailman/data/virtual-mailman, hash:/etc/postfix/virtual-alias, ldap:/etc/postfix/ldap-aliases.cf virtual_transport = dovecot dovecot_destination_recipient_limit = 1 diff --git a/roles/mail/templates/postfix/virtual-alias.j2 b/roles/mail/templates/postfix/virtual-alias.j2 new file mode 100644 index 0000000..e69de29