Skip to content

Commit 145dd91

Browse files
author
Lenhard Reuter
committed
Allow docker deployment
1 parent 9a4f2fc commit 145dd91

File tree

3 files changed

+15
-25
lines changed

3 files changed

+15
-25
lines changed

defaults/main.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
---
22
novnc_server_name: "novnc.cyberrange.rocks"
3-
novnc_listen: "80"
43
novnc_listen_ssl: "443 ssl"
54

65
novnc_upstreams: []
76
novnc_htpasswd_credentials: []
87

98
fabric_copypaste_bar: true
109
fabric_wwwroot: "/var/www/fabric"
10+
fabric_conf_wwwroot: "{{ fabric_wwwroot }}"
1111
fabric_index_template: "{{ 'index.html.j2' if fabric_copypaste_bar else 'minimal.html.j2' }}"
1212

1313
fabric_version: "latest"
@@ -17,3 +17,6 @@ fabric_title: "AIT Fabric"
1717

1818
novnc_ssl_cert: ""
1919
novnc_ssl_key: ""
20+
21+
fabric_docker_nginx: false
22+
fabric_docker_nginx_conf_file: /etc/nginx/conf.d/novnc.conf

tasks/main.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@
55
file: nginx.yml
66
apply:
77
become: true
8+
when: not fabric_docker_nginx
9+
10+
- name: Add NGINX configuration file
11+
become: true
12+
ansible.builtin.template:
13+
dest: "{{ fabric_docker_nginx_conf_file }}"
14+
src: nginx_novnc.conf.j2
15+
mode: "0644"
16+
when: fabric_docker_nginx
817

918
- name: Configure and install fabric
1019
tags: [fabric]

templates/nginx_novnc.conf.j2

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,41 +4,23 @@ upstream {{ upstream.name }} {
44
}
55
{% endfor %}
66

7-
{% if novnc_ssl_cert and novnc_ssl_key %}
87
server {
9-
listen {{ novnc_listen }};
8+
listen 80;
109
server_name {{ novnc_server_name }};
1110

1211
location / {
1312
return 301 https://$host$request_uri;
1413
}
1514
}
16-
{% endif %}
1715

1816
server {
19-
{% if novnc_ssl_cert and novnc_ssl_key %}
2017
listen {{ novnc_listen_ssl }};
2118
ssl_certificate {{ novnc_ssl_cert }};
2219
ssl_certificate_key {{ novnc_ssl_key }};
23-
{% else %}
24-
listen {{ novnc_listen }};
25-
{% endif %}
2620

2721
server_name {{ novnc_server_name }};
28-
root {{ fabric_wwwroot }};
22+
root {{ fabric_conf_wwwroot }};
2923

30-
{% if novnc_htpasswd_credentials %}
31-
auth_basic "noVNC Authentication";
32-
auth_basic_user_file /etc/nginx/passwdfile;
33-
34-
location = / {
35-
try_files DUMMY @login;
36-
}
37-
38-
location @login {
39-
return 302 $scheme://$host/$remote_user;
40-
}
41-
{% endif %}
4224
location / {
4325
try_files $uri $uri/ /index.html;
4426
}
@@ -57,10 +39,6 @@ server {
5739

5840
{% for upstream in novnc_upstreams %}
5941
location /upstream/{{ upstream.name }} {
60-
{% if novnc_htpasswd_credentials %}
61-
auth_basic "noVNC {{ upstream.username }} Authentication";
62-
auth_basic_user_file /etc/nginx/passwd-{{ upstream.username }};
63-
{% endif %}
6442
proxy_pass http://{{ upstream.name }}/;
6543
}
6644

0 commit comments

Comments
 (0)