Roles: add service-nginx-openlayers
This commit is contained in:
parent
026844de30
commit
3dbcb8f2c5
7 changed files with 106 additions and 0 deletions
|
@ -12,6 +12,7 @@ http_meshviewer_prefix: map
|
||||||
http_grafana_prefix: stats
|
http_grafana_prefix: stats
|
||||||
http_lookingglass_prefix: lg
|
http_lookingglass_prefix: lg
|
||||||
http_prometheus_prefix: prom
|
http_prometheus_prefix: prom
|
||||||
|
http_openlayers_prefix: ol
|
||||||
|
|
||||||
prometheus_conf_main: prometheus/prometheus.yml.j2
|
prometheus_conf_main: prometheus/prometheus.yml.j2
|
||||||
|
|
||||||
|
|
18
roles/service-nginx-openlayers/README.md
Normal file
18
roles/service-nginx-openlayers/README.md
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
# Ansible role service-nginx-openlayers
|
||||||
|
|
||||||
|
Diese Ansible role installert OpenLayers und konfiguriert den nginx vHosts.
|
||||||
|
|
||||||
|
- schreibt openlayers.conf
|
||||||
|
- legt OpenLayers Verzeichnis an
|
||||||
|
- installert OpenLayers
|
||||||
|
|
||||||
|
## Benötigte Variablen
|
||||||
|
|
||||||
|
- Variable `openlayers_src` (Rollen Variable)
|
||||||
|
- Variable `openlayers_path` (Rollen Variable)
|
||||||
|
- Variable `openlayers_version` (Rollen Variable)
|
||||||
|
- Variable `http_openlayers_external` (Rollen Variable)
|
||||||
|
- Variable `http_openlayers_internal` (Rollen Variable)
|
||||||
|
- Variable `http_openlayers_prefix` # string: Subdomain
|
||||||
|
- Variable `http_domain_external` # string: Externe Freifunk MWU Domain
|
||||||
|
- Variable `http_domain_internal` # string: Interne Freifunk MWU Domain
|
5
roles/service-nginx-openlayers/handlers/main.yml
Normal file
5
roles/service-nginx-openlayers/handlers/main.yml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
- name: restart nginx
|
||||||
|
systemd:
|
||||||
|
name: nginx
|
||||||
|
state: restarted
|
3
roles/service-nginx-openlayers/meta/main.yml
Normal file
3
roles/service-nginx-openlayers/meta/main.yml
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
---
|
||||||
|
dependencies:
|
||||||
|
- { role: service-nginx }
|
42
roles/service-nginx-openlayers/tasks/main.yml
Normal file
42
roles/service-nginx-openlayers/tasks/main.yml
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
---
|
||||||
|
- name: create directory
|
||||||
|
file:
|
||||||
|
path: "{{ openlayers_path }}"
|
||||||
|
state: directory
|
||||||
|
mode: 0755
|
||||||
|
owner: www-data
|
||||||
|
group: www-data
|
||||||
|
|
||||||
|
- name: download and extract
|
||||||
|
unarchive:
|
||||||
|
creates: "{{ openlayers_path }}/{{ openlayers_version }}"
|
||||||
|
src: "{{ openlayers_src }}"
|
||||||
|
dest: "{{ openlayers_path }}"
|
||||||
|
remote_src: yes
|
||||||
|
owner: www-data
|
||||||
|
group: www-data
|
||||||
|
|
||||||
|
- name: create symlinks
|
||||||
|
file:
|
||||||
|
src: "{{ openlayers_version }}/{{ item }}"
|
||||||
|
dest: "{{ openlayers_path }}/{{ item }}"
|
||||||
|
state: link
|
||||||
|
loop:
|
||||||
|
- build
|
||||||
|
- css
|
||||||
|
|
||||||
|
- name: write vhost
|
||||||
|
template:
|
||||||
|
src: openlayers_vhost.conf.j2
|
||||||
|
dest: /etc/nginx/conf.d/openlayers.conf
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: 0644
|
||||||
|
notify: restart nginx
|
||||||
|
|
||||||
|
- name: fix permissions
|
||||||
|
file:
|
||||||
|
path: "{{ openlayers_path }}"
|
||||||
|
owner: www-data
|
||||||
|
group: www-data
|
||||||
|
recurse: yes
|
|
@ -0,0 +1,30 @@
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
listen [::]:80;
|
||||||
|
server_name {{ http_openlayers_external }} {{ http_openlayers_internal }};
|
||||||
|
|
||||||
|
include /etc/nginx/snippets/gzip.conf;
|
||||||
|
include /etc/nginx/snippets/letsencrypt-acme-challenge.conf;
|
||||||
|
|
||||||
|
root {{ openlayers_path }};
|
||||||
|
location / {
|
||||||
|
autoindex on;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 443 ssl http2;
|
||||||
|
listen [::]:443 ssl http2;
|
||||||
|
server_name {{ http_openlayers_external }} {{ http_openlayers_internal }};
|
||||||
|
|
||||||
|
ssl_certificate /etc/nginx/ssl/{{ inventory_hostname_short }}.{{ http_domain_external }}/fullchain.pem;
|
||||||
|
ssl_certificate_key /etc/nginx/ssl/{{ inventory_hostname_short }}.{{ http_domain_external }}/privkey.pem;
|
||||||
|
|
||||||
|
include /etc/nginx/snippets/gzip.conf;
|
||||||
|
include /etc/nginx/snippets/letsencrypt-acme-challenge.conf;
|
||||||
|
|
||||||
|
root {{ openlayers_path }};
|
||||||
|
location / {
|
||||||
|
autoindex on;
|
||||||
|
}
|
||||||
|
}
|
7
roles/service-nginx-openlayers/vars/main.yml
Normal file
7
roles/service-nginx-openlayers/vars/main.yml
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
---
|
||||||
|
http_openlayers_external: "{{ http_openlayers_prefix }}.{{ http_domain_external }}"
|
||||||
|
http_openlayers_internal: "{{ http_openlayers_prefix }}.{{ http_domain_internal }}"
|
||||||
|
|
||||||
|
openlayers_version: "v5.3.0"
|
||||||
|
openlayers_path: "/var/www/{{ http_openlayers_external }}"
|
||||||
|
openlayers_src: "https://github.com/openlayers/openlayers/releases/download/{{ openlayers_version }}/{{ openlayers_version }}.zip"
|
Loading…
Reference in a new issue