summaryrefslogtreecommitdiffstats
path: root/supporting/servers/roles/ngnix
diff options
context:
space:
mode:
authorzhifeng.jiang <jiang.zhifeng@zte.com.cn>2016-11-02 22:28:26 +0800
committerzhifeng.jiang <jiang.zhifeng@zte.com.cn>2016-11-03 15:58:28 +0800
commit44b306376ddd425acdb64a36fe77dfe7a9992a93 (patch)
treebca58b037b724b7e0c3d386b93a3ea5605367135 /supporting/servers/roles/ngnix
parentcdd2320235e1fec0b883dc79b8f2cbd5d931cede (diff)
Fix ansible Syntax Error while loading YAML and separates
docker,elk and nginx installing file. JIRA:QTIP-111 Change-Id: I8fe004b0edc86729e1beff07b406b568af60da89 Signed-off-by: zhifeng.jiang <jiang.zhifeng@zte.com.cn>
Diffstat (limited to 'supporting/servers/roles/ngnix')
-rw-r--r--supporting/servers/roles/ngnix/defaults/main.yml4
-rw-r--r--supporting/servers/roles/ngnix/handlers/main.yml4
-rw-r--r--supporting/servers/roles/ngnix/tasks/main.yml11
-rw-r--r--supporting/servers/roles/ngnix/templates/elk.conf.j214
4 files changed, 33 insertions, 0 deletions
diff --git a/supporting/servers/roles/ngnix/defaults/main.yml b/supporting/servers/roles/ngnix/defaults/main.yml
new file mode 100644
index 00000000..855fc7ea
--- /dev/null
+++ b/supporting/servers/roles/ngnix/defaults/main.yml
@@ -0,0 +1,4 @@
+---
+services:
+ - { name: kibana, upstream: 'http://127.0.0.1:5601' }
+ - { name: elastic, upstream: 'http://127.0.0.1:9200' }
diff --git a/supporting/servers/roles/ngnix/handlers/main.yml b/supporting/servers/roles/ngnix/handlers/main.yml
new file mode 100644
index 00000000..35585363
--- /dev/null
+++ b/supporting/servers/roles/ngnix/handlers/main.yml
@@ -0,0 +1,4 @@
+---
+- name: restart nginx
+ become: true
+ service: name=nginx state=restarted
diff --git a/supporting/servers/roles/ngnix/tasks/main.yml b/supporting/servers/roles/ngnix/tasks/main.yml
new file mode 100644
index 00000000..8673b3d2
--- /dev/null
+++ b/supporting/servers/roles/ngnix/tasks/main.yml
@@ -0,0 +1,11 @@
+---
+- 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
+ notify:
+ - restart nginx
diff --git a/supporting/servers/roles/ngnix/templates/elk.conf.j2 b/supporting/servers/roles/ngnix/templates/elk.conf.j2
new file mode 100644
index 00000000..271690e0
--- /dev/null
+++ b/supporting/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 %}