aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYujun Zhang <zhang.yujunz@zte.com.cn>2016-10-13 06:26:17 +0000
committerGerrit Code Review <gerrit@opnfv.org>2016-10-13 06:26:17 +0000
commit69019f4dceec6f8bcb9eaf540b5f7257fce9530f (patch)
treef9159379356884300564c15b8fa43cf7b8ac2213
parentf7b4e61fcc20c5814d9b7ed5ebefbec1b549cd03 (diff)
parent58174636628ef4dcd144a6b4b5dca7228bb1e3d1 (diff)
Merge "Add playbook to deploy nginx for elk"
-rw-r--r--supporting/servers/ansible.cfg3
-rw-r--r--supporting/servers/elk.yml4
-rw-r--r--supporting/servers/inventory4
-rw-r--r--supporting/servers/roles/elk/defaults/main.yml4
-rw-r--r--supporting/servers/roles/elk/handlers/main.yml4
-rw-r--r--supporting/servers/roles/elk/tasks/main.yml11
-rw-r--r--supporting/servers/roles/elk/templates/elk.conf.j214
7 files changed, 44 insertions, 0 deletions
diff --git a/supporting/servers/ansible.cfg b/supporting/servers/ansible.cfg
new file mode 100644
index 00000000..93022c4e
--- /dev/null
+++ b/supporting/servers/ansible.cfg
@@ -0,0 +1,3 @@
+[defaults]
+hostfile = inventory
+host_key_checking = False \ No newline at end of file
diff --git a/supporting/servers/elk.yml b/supporting/servers/elk.yml
new file mode 100644
index 00000000..406ba93f
--- /dev/null
+++ b/supporting/servers/elk.yml
@@ -0,0 +1,4 @@
+---
+- hosts: elk-servers
+ roles:
+ - elk
diff --git a/supporting/servers/inventory b/supporting/servers/inventory
new file mode 100644
index 00000000..aa9388fe
--- /dev/null
+++ b/supporting/servers/inventory
@@ -0,0 +1,4 @@
+qtip-dev ansible_host=qtip
+
+[elk-servers]
+qtip-dev \ No newline at end of file
diff --git a/supporting/servers/roles/elk/defaults/main.yml b/supporting/servers/roles/elk/defaults/main.yml
new file mode 100644
index 00000000..855fc7ea
--- /dev/null
+++ b/supporting/servers/roles/elk/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/elk/handlers/main.yml b/supporting/servers/roles/elk/handlers/main.yml
new file mode 100644
index 00000000..35585363
--- /dev/null
+++ b/supporting/servers/roles/elk/handlers/main.yml
@@ -0,0 +1,4 @@
+---
+- name: restart nginx
+ become: true
+ service: name=nginx state=restarted
diff --git a/supporting/servers/roles/elk/tasks/main.yml b/supporting/servers/roles/elk/tasks/main.yml
new file mode 100644
index 00000000..8673b3d2
--- /dev/null
+++ b/supporting/servers/roles/elk/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/elk/templates/elk.conf.j2 b/supporting/servers/roles/elk/templates/elk.conf.j2
new file mode 100644
index 00000000..271690e0
--- /dev/null
+++ b/supporting/servers/roles/elk/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 %}