diff --git a/roles/mail/handlers/main.yml b/roles/mail/handlers/main.yml index 33dde2c..91660cf 100644 --- a/roles/mail/handlers/main.yml +++ b/roles/mail/handlers/main.yml @@ -6,6 +6,9 @@ - name: Restart dovecot service: name=dovecot state=restarted +- name: Restart nginx + service: name=nginx state=restarted + - name: Restart postfix service: name=postfix state=restarted diff --git a/roles/mail/tasks/main.yml b/roles/mail/tasks/main.yml index d643cd3..6ac3ea7 100644 --- a/roles/mail/tasks/main.yml +++ b/roles/mail/tasks/main.yml @@ -10,6 +10,7 @@ - dovecot-ldap - dovecot-managesieved - dovecot-sieve + - fcgiwrap - mailman - postfix - postfix-ldap @@ -59,6 +60,16 @@ notify: Restart postfix tags: mail +- name: Configure mailman vhost + template: src=mailman/vhost.j2 dest=/etc/nginx/sites-available/mailman + notify: Restart nginx + tags: mail + +- name: Enable mailman vhost + file: src=/etc/nginx/sites-available/mailman dest=/etc/nginx/sites-enabled/mailman state=link + notify: Restart nginx + tags: mail + - name: Configure policyd copy: src={{ item }} dest=/etc/postfix-policyd-spf-python/{{ item }} with_items: @@ -113,6 +124,10 @@ service: name=dovecot state=started enabled=yes tags: mail +- name: Start fcgiwrap + service: name=fcgiwrap state=started enabled=yes + tags: mail + - name: Start postfix service: name=postfix state=started enabled=yes tags: mail diff --git a/roles/mail/templates/nginx/vhost.j2 b/roles/mail/templates/nginx/vhost.j2 new file mode 100644 index 0000000..3c547de --- /dev/null +++ b/roles/mail/templates/nginx/vhost.j2 @@ -0,0 +1,34 @@ +server { + listen 80; + server_name {{ mailman_domain }}; + root /usr/lib/; + + location = / { + rewrite ^ /mailman/listinfo permanent; + } + + location / { + rewrite ^ /mailman$uri?$args; + } + + location = /mailman/ { + rewrite ^ /mailman/listinfo permanent; + } + + location /mailman { + fastcgi_split_path_info (^/mailman/[^/]*)(.*)$; + include /etc/nginx/fastcgi_params; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_param PATH_INFO $fastcgi_path_info; + fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; + fastcgi_intercept_errors on; + fastcgi_pass unix:/var/run/fcgiwrap.socket; + } + location /images/mailman { + alias /usr/share/images/mailman; + } + location /pipermail { + alias /var/lib/mailman/archives/public; + autoindex on; + } +}