aboutsummaryrefslogtreecommitdiffstats
path: root/opt/servers/roles/ngnix
diff options
context:
space:
mode:
Diffstat (limited to 'opt/servers/roles/ngnix')
-rw-r--r--opt/servers/roles/ngnix/defaults/main.yml7
-rw-r--r--opt/servers/roles/ngnix/handlers/main.yml4
-rw-r--r--opt/servers/roles/ngnix/tasks/main.yml12
-rw-r--r--opt/servers/roles/ngnix/templates/elk.conf.j214
-rw-r--r--opt/servers/roles/ngnix/templates/qtip.conf.j217
5 files changed, 54 insertions, 0 deletions
diff --git a/opt/servers/roles/ngnix/defaults/main.yml b/opt/servers/roles/ngnix/defaults/main.yml
new file mode 100644
index 00000000..cb3b3934
--- /dev/null
+++ b/opt/servers/roles/ngnix/defaults/main.yml
@@ -0,0 +1,7 @@
+---
+services:
+ - { name: kibana, upstream: 'http://127.0.0.1:5601' }
+ - { name: elastic, upstream: 'http://127.0.0.1:9200' }
+
+qtip_services:
+ - { name: restful_api, upstream: 'http://127.0.0.1:5000' }
diff --git a/opt/servers/roles/ngnix/handlers/main.yml b/opt/servers/roles/ngnix/handlers/main.yml
new file mode 100644
index 00000000..35585363
--- /dev/null
+++ b/opt/servers/roles/ngnix/handlers/main.yml
@@ -0,0 +1,4 @@
+---
+- name: restart nginx
+ become: true
+ service: name=nginx state=restarted
diff --git a/opt/servers/roles/ngnix/tasks/main.yml b/opt/servers/roles/ngnix/tasks/main.yml
new file mode 100644
index 00000000..ec146850
--- /dev/null
+++ b/opt/servers/roles/ngnix/tasks/main.yml
@@ -0,0 +1,12 @@
+---
+- name: nginx is installed
+ become: true
+ package: name=nginx state=present
+- name: qtip server configuration is generated
+ become: true
+ template: src={{ item }}.conf.j2 dest=/etc/nginx/sites-enabled/{{ item }}.conf
+ with_items:
+ - elk
+ - qtip
+ notify:
+ - restart nginx
diff --git a/opt/servers/roles/ngnix/templates/elk.conf.j2 b/opt/servers/roles/ngnix/templates/elk.conf.j2
new file mode 100644
index 00000000..271690e0
--- /dev/null
+++ b/opt/servers/roles/ngnix/templates/elk.conf.j2
@@ -0,0 +1,14 @@
+# {{ ansible_managed }}
+
+# servers
+#
+{% for service in services %}
+server {
+ listen 80;
+ listen 443 ssl;
+ server_name {{ service.name }}.qtip.openzero.net;
+ location / {
+ proxy_pass {{ service.upstream }};
+ }
+}
+{% endfor %}
diff --git a/opt/servers/roles/ngnix/templates/qtip.conf.j2 b/opt/servers/roles/ngnix/templates/qtip.conf.j2
new file mode 100644
index 00000000..3a15c6ba
--- /dev/null
+++ b/opt/servers/roles/ngnix/templates/qtip.conf.j2
@@ -0,0 +1,17 @@
+# {{ ansible_managed }}
+
+# servers
+#
+{% for service in qtip_services %}
+server {
+ listen 80;
+ listen 443 ssl;
+ server_name {{ service.name }}.qtip.openzero.net;
+ location / {
+ proxy_pass {{ service.upstream }};
+ sub_filter {{ service.upstream }} 'http://{{ service.name }}.qtip.openzero.net';
+ sub_filter_once off;
+ sub_filter_types text/html application/json;
+ }
+}
+{% endfor %}