Merge branch 'http-site-forward'

This commit is contained in:
Stefan Haun 2020-12-04 18:55:09 +01:00
commit 55eaa92f6e
5 changed files with 64 additions and 0 deletions

View file

@ -0,0 +1,5 @@
---
- name: restart apache2
service:
name: apache2
state: restarted

View file

@ -0,0 +1,12 @@
---
- name: Add or update Apache2 site
template:
src: templates/apache-docker-forward-site.j2
dest: /etc/apache2/sites-available/{{site_name}}.conf
notify: restart apache2
- name: Activate Apache2 site
command: a2ensite {{ site_name}}
args:
creates: /etc/apache2/sites-enabled/{{ site_name }}.conf
notify: restart apache2

View file

@ -0,0 +1,38 @@
<VirtualHost {{ ansible_default_ipv4.address }}:80>
ServerAdmin {{ server_admin }}
ServerName {{ site_name }}
ServerAlias {{ site_name }}
ErrorLog /var/log/apache2/{{ site_name }}-error.log
CustomLog /var/log/apache2/{{ site_name }}-access.log common
Alias /.well-known/acme-challenge /usr/local/etc/dehydrated/challenge
<ifmodule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/\.well\-known/acme\-challenge/
RewriteRule (.*) {{forward_to}} [R=301,L]
</ifmodule>
</VirtualHost>
<VirtualHost {{ ansible_default_ipv4.address }}:443>
ServerAdmin {{ server_admin }}
ServerName {{ site_name }}
ServerAlias {{ site_name }}
ErrorLog /var/log/apache2/{{ site_name }}-error.log
CustomLog /var/log/apache2/{{ site_name }}-access.log common
SSLEngine on
SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown
SSLCertificateFile /usr/local/etc/dehydrated/certs/{{ site_name }}/cert.pem
SSLCertificateKeyFile /usr/local/etc/dehydrated/certs/{{ site_name }}/privkey.pem
SSLCertificateChainFile /usr/local/etc/dehydrated/certs/{{ site_name }}/chain.pem
Alias /.well-known/acme-challenge /usr/local/etc/dehydrated/challenge
<ifmodule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/\.well\-known/acme\-challenge/
RewriteRule (.*) {{forward_to}} [R=301,L]
</ifmodule>
</VirtualHost>

View file

@ -5,6 +5,8 @@
ErrorLog /var/log/apache2/{{ site_name }}-error.log ErrorLog /var/log/apache2/{{ site_name }}-error.log
CustomLog /var/log/apache2/{{ site_name }}-access.log common CustomLog /var/log/apache2/{{ site_name }}-access.log common
Alias /.well-known/acme-challenge /usr/local/etc/dehydrated/challenge
<ifmodule mod_rewrite.c> <ifmodule mod_rewrite.c>
RewriteEngine On RewriteEngine On
RewriteCond %{REQUEST_URI} !^/\.well\-known/acme\-challenge/ RewriteCond %{REQUEST_URI} !^/\.well\-known/acme\-challenge/

View file

@ -11,6 +11,13 @@
state: present state: present
- name: Setup forward site reservierung.netz39.de
include_role:
name: setup-http-site-forward
vars:
site_name: reservierung.netz39.de
forward_to: https://codimd.pingtech.de/aYsBj5wSTviFTozd8b0P_Q
- name: Setup proxy site testredmine.netz39.de - name: Setup proxy site testredmine.netz39.de
include_role: include_role: