diff --git a/defaults/main.yml b/defaults/main.yml index 2e12af6..6d2e2e9 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,3 +1,6 @@ postfixadmin_mysql_host: localhost postfixadmin_mysql_database: postfixadmin postfixadmin_mysql_username: postfixadmin +postfixadmin_server_name: "{{inventory_hostname}}" +postfixadmin_certificate_fullchain_file: /etc/ssl/certs/ssl-cert-snakeoil.pem +postfixadmin_certificate_private_key_file: /etc/ssl/private/ssl-cert-snakeoil.key diff --git a/tasks/main.yml b/tasks/main.yml index 191bfc5..3841177 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -19,7 +19,7 @@ debconf: name: postfixadmin question: postfixadmin/dbconfig-{{item}} - answer: false + answer: 'false' vtype: boolean with_items: - install @@ -63,24 +63,17 @@ # url: http://localhost/postfixadmin/setup.php # dest: /var/www/html/postfixadmin-setup-report.html -- name: apache2 default vhost config +- name: apache2 vhost config template: - src: apache2_default_vhost.conf.j2 - dest: /etc/apache2/sites-available/000-default.conf + src: apache2-vhost.conf.j2 + dest: /etc/apache2/sites-available/postfixadmin.conf notify: - apache2 reload -- name: apache2 default-ssl vhost config - template: - src: apache2_default-ssl_vhost.conf.j2 - dest: /etc/apache2/sites-available/default-ssl.conf - notify: - - apache2 reload - -- name: apache2 default-ssl vhost enable +- name: apache2 vhost enable file: - src: ../sites-available/default-ssl.conf - dest: /etc/apache2/sites-enabled/default-ssl.conf + src: ../sites-available/postfixadmin.conf + dest: /etc/apache2/sites-enabled/postfixadmin.conf state: link notify: - apache2 reload @@ -92,5 +85,10 @@ notify: - apache2 reload +- name: disable postfixadmin apache2 config + file: + path: /etc/apache2/conf-enabled/postfixadmin.conf + state: absent + - name: flush handlers meta: flush_handlers diff --git a/templates/apache2_default-ssl_vhost.conf.j2 b/templates/apache2-vhost.conf.j2 similarity index 78% rename from templates/apache2_default-ssl_vhost.conf.j2 rename to templates/apache2-vhost.conf.j2 index 2497f14..bdb698f 100644 --- a/templates/apache2_default-ssl_vhost.conf.j2 +++ b/templates/apache2-vhost.conf.j2 @@ -8,9 +8,8 @@ CustomLog ${APACHE_LOG_DIR}/access.log combined SSLEngine on - - SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem - SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key + SSLCertificateFile "{{postfixadmin_certificate_fullchain_file}}" + SSLCertificateKeyFile "{{postfixadmin_certificate_private_key_file}}" SSLOptions +StdEnvVars diff --git a/templates/apache2_default_vhost.conf.j2 b/templates/apache2_default_vhost.conf.j2 deleted file mode 100644 index 4d6d579..0000000 --- a/templates/apache2_default_vhost.conf.j2 +++ /dev/null @@ -1,8 +0,0 @@ - - ServerAdmin webmaster@localhost - - Redirect / https://{{inventory_hostname}}/ - - ErrorLog ${APACHE_LOG_DIR}/error.log - CustomLog ${APACHE_LOG_DIR}/access.log combined -