summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlinux_geek <taseer94@gmail.com>2016-10-14 07:54:45 +0500
committerTaseer Ahmed <taseer94@gmail.com>2016-10-14 15:58:39 +0000
commit5f81947827003e5541083ecc6f95b8ca6f0dce93 (patch)
tree65645340bf4af7ca5d32f31e0d0ced18fa0186f5
parent975e241de4d4bf3839c788ad743d0cc077e23bd4 (diff)
Playbook for setting up ELK.
Change-Id: Iccd8531a7c292796b76f2ab23bc8a2ca5d2d99ed Signed-off-by: Taseer Ahmed <taseer94@gmail.com>
-rw-r--r--supporting/servers/roles/elk/handlers/main.yml4
-rw-r--r--supporting/servers/roles/elk/tasks/main.yml49
2 files changed, 53 insertions, 0 deletions
diff --git a/supporting/servers/roles/elk/handlers/main.yml b/supporting/servers/roles/elk/handlers/main.yml
index 35585363..46bd76c7 100644
--- a/supporting/servers/roles/elk/handlers/main.yml
+++ b/supporting/servers/roles/elk/handlers/main.yml
@@ -1,4 +1,8 @@
---
+- name: starting docker service
+ become: true
+ service: name=docker state=started
+
- 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
index 8673b3d2..7628f378 100644
--- a/supporting/servers/roles/elk/tasks/main.yml
+++ b/supporting/servers/roles/elk/tasks/main.yml
@@ -1,4 +1,53 @@
---
+- name: adding keys
+ become: true
+ apt_key: keyserver=hkp://p80.pool.sks-keyservers.net id=0X58118E89F3A912897C070ADBF76221572C52609D
+
+- name: adding entry for ubuntu
+ become: true
+ apt_repository: repo='deb https://apt.dockerproject.org/repo ubuntu-xenial main' state=present filename='docker'
+ when: ansible_distribution == "Ubuntu" and ansible_distribution_version == "16.04"
+
+- name: installing from docker repo
+ become: true
+ shell: apt-cache policy docker-engine
+ when: ansible_distribution == "Ubuntu" and ansible_distribution_version== "16.04"
+
+- name: adding entry for ubuntu
+ become: true
+ apt_repository: repo='deb https://apt.dockerproject.org/repo ubuntu-trusty main' state=present filename='docker'
+ when: ansible_distribution == "Ubuntu" and ansible_distribution_version == "14.04"
+
+- name: updating
+ become: true
+ apt: update_cache=yes
+
+- name: installing docker engine
+ become: true
+ apt: name=docker-engine
+
+- name: pulling elasticsearch and kibana
+ become: true
+ docker_image: name={{ item }} state=present
+ with_items:
+ - elasticsearch
+ - kibana
+
+- name: setting up elasticsearch
+ become: true
+ docker_container:
+ name: esearch
+ image: elasticsearch
+ published_ports: 9200:9200
+
+- name: setting up kibana
+ become: true
+ docker_container:
+ name: kibana
+ image: kibana
+ published_ports: 5601:5601
+ links: esearch:elasticsearch
+
- name: nginx is installed
become: true
package: name=nginx state=present