add postfixadmin

This commit is contained in:
genofire 2020-07-22 16:06:30 +02:00
parent 9bf0abd3e5
commit 4097334294
5 changed files with 52 additions and 1 deletions

2
defaults/main.yml Normal file
View File

@ -0,0 +1,2 @@
---
mailserver_postfixadmin_domain: ""

5
handlers/main.yml Normal file
View File

@ -0,0 +1,5 @@
---
- name: reload nginx
systemd:
name: nginx
state: reloaded

View File

@ -1,2 +1,4 @@
dependencies: dependencies:
- role: webserver - role: webserver
vars:
webserver_php_enabled: true

View File

@ -3,4 +3,25 @@
name: name:
- postgresql - postgresql
- postfixadmin - postfixadmin
- php-fpm
- name: nginx local
notify: reload nginx
when: mailserver_postfixadmin_domain == ""
template:
src: postfixadmin-local.nginx
dest: /etc/nginx/local.d/postfixadmin.act
- name: nginx domain
notify: reload nginx
when: mailserver_postfixadmin_domain != ""
template:
src: postfixadmin-domain.nginx
dest: /etc/nginx/sites.d/postfixadmin.act
- name: allow access php to postfixadmin.conf
file:
path: "/etc/webapps/postfixadmin/{{ item }}"
group: http
with_items:
- config.inc.php
- config.local.php

View File

@ -0,0 +1,21 @@
location /postfixadmin {
rewrite ^/postfixadmin/?(.*)$ /postfixadmin/public/$1 last;
}
location /postfixadmin/public {
root /usr/share/webapps;
index index.html index.htm index.php;
location ~ \.php(?:$|/) {
fastcgi_split_path_info ^(.+.php)(/.+)$;
fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
include fastcgi.conf;
fastcgi_param PHP_ADMIN_VALUE open_basedir=/etc/webapps/postfixadmin/:/usr/share/webapps/postfixadmin:/tmp:/usr/share/pear:/dev/urandom;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param HTTPS on;
}
}