CORD-705: ELK logging and debugger for CORD

Change-Id: I3406d95161e71976ee3b3bf689f89069b4d9de73
diff --git a/ansible/roles/common/defaults/main.yml b/ansible/roles/common/defaults/main.yml
index 4bc74b9..add8842 100644
--- a/ansible/roles/common/defaults/main.yml
+++ b/ansible/roles/common/defaults/main.yml
@@ -1,6 +1,7 @@
 hosts: [
   { host_ip: "10.100.198.200", host_name: "corddev"},
   { host_ip: "10.100.198.201", host_name: "prod"},
+  { host_ip: "10.100.198.222", host_name: "elastic"},
 ]
 
 use_latest_for:
diff --git a/ansible/roles/install_elk/files/10-udp-input.conf b/ansible/roles/install_elk/files/10-udp-input.conf
new file mode 100644
index 0000000..d144f5b
--- /dev/null
+++ b/ansible/roles/install_elk/files/10-udp-input.conf
@@ -0,0 +1,6 @@
+input {
+  udp {
+    port => 5617
+    codec => json
+  }
+}
diff --git a/ansible/roles/install_elk/files/30-elasticsearch-output.conf b/ansible/roles/install_elk/files/30-elasticsearch-output.conf
new file mode 100644
index 0000000..ab51625
--- /dev/null
+++ b/ansible/roles/install_elk/files/30-elasticsearch-output.conf
@@ -0,0 +1,4 @@
+output {
+  elasticsearch { hosts => ["localhost:9200"] }
+  stdout { codec => rubydebug }
+}
diff --git a/ansible/roles/install_elk/tasks/main.yml b/ansible/roles/install_elk/tasks/main.yml
new file mode 100644
index 0000000..c807425
--- /dev/null
+++ b/ansible/roles/install_elk/tasks/main.yml
@@ -0,0 +1,54 @@
+- name: Add ELK repositories
+  apt_repository: repo={{ item }} state="present"
+  with_items:
+      - deb http://packages.elastic.co/elasticsearch/2.x/debian stable main
+      - deb http://packages.elastic.co/kibana/4.4/debian stable main
+      - deb http://packages.elastic.co/logstash/2.2/debian stable main
+
+- name: Install ELK
+  apt: name={{ item }} state=installed update_cache=yes force=yes
+  with_items:
+      - elasticsearch
+      - kibana
+      - logstash
+
+- name: Configure Logstash
+  copy: src={{ item }} dest=/etc/logstash/conf.d/{{ item }} owner=root group=root mode=0644
+  with_items:
+      - 10-udp-input.conf
+      - 30-elasticsearch-output.conf
+
+- name: Start ELK
+  service: name={{ item }} state=started enabled=yes
+  with_items:
+      - logstash
+      - elasticsearch
+      - kibana
+
+- name: Add ELK repositories
+  apt_repository: repo={{ item }} state="present"
+  with_items:
+      - deb http://packages.elastic.co/elasticsearch/2.x/debian stable main
+      - deb http://packages.elastic.co/kibana/4.4/debian stable main
+      - deb http://packages.elastic.co/logstash/2.2/debian stable main
+
+- name: Install ELK
+  apt: name={{ item }} state=installed update_cache=yes force=yes
+  with_items:
+      - elasticsearch
+      - kibana
+      - logstash
+
+- name: Configure Logstash
+  copy: src={{ item }} dest=/etc/logstash/conf.d/{{ item }} owner=root group=root mode=0644
+  with_items:
+      - 10-udp-input.conf
+      - 30-elasticsearch-output.conf
+
+- name: Start ELK
+  service: name={{ item }} state=started enabled=yes
+  with_items:
+      - logstash
+      - elasticsearch
+      - kibana
+