aboutsummaryrefslogtreecommitdiffstats
path: root/sdc-os-chef/sdc-init-elasticsearch
diff options
context:
space:
mode:
authorAreli, Fuss (af732p) <af732p@intl.att.com>2018-04-24 13:59:00 +0300
committerAreli, Fuss (af732p) <af732p@att.com>2018-04-24 14:59:09 +0300
commitc033cdce906efc3b6ccd1d2f45544af47e328ed4 (patch)
tree40c4657a73d9a52f5f2784cff9a3dcb1833467ce /sdc-os-chef/sdc-init-elasticsearch
parentc175a0de2f05d37c1c774684318a525eb96bb59b (diff)
Add cluster resiliance support
Add configuration support for CS/ES cluster and add truststore default files to support ssl connection Change-Id: Icc2831704e8a3c55ce9b380a39001891ce8d41ab Issue-ID: SDC-1254 Signed-off-by: Areli, Fuss (af732p) <af732p@intl.att.com>
Diffstat (limited to 'sdc-os-chef/sdc-init-elasticsearch')
-rw-r--r--sdc-os-chef/sdc-init-elasticsearch/chef-repo/cookbooks/init-sdc-elasticsearch/recipes/ES_1_create_audit_template.rb11
-rw-r--r--sdc-os-chef/sdc-init-elasticsearch/chef-repo/cookbooks/init-sdc-elasticsearch/recipes/ES_2_create_resources_template.rb7
-rw-r--r--sdc-os-chef/sdc-init-elasticsearch/chef-repo/cookbooks/init-sdc-elasticsearch/recipes/ES_3_create_monitoring_template.rb7
-rw-r--r--sdc-os-chef/sdc-init-elasticsearch/chef-repo/cookbooks/init-sdc-elasticsearch/recipes/ES_4_create_kibana_dashboard_virtualization.rb9
4 files changed, 23 insertions, 11 deletions
diff --git a/sdc-os-chef/sdc-init-elasticsearch/chef-repo/cookbooks/init-sdc-elasticsearch/recipes/ES_1_create_audit_template.rb b/sdc-os-chef/sdc-init-elasticsearch/chef-repo/cookbooks/init-sdc-elasticsearch/recipes/ES_1_create_audit_template.rb
index 35bf49fb6d..8ee4087325 100644
--- a/sdc-os-chef/sdc-init-elasticsearch/chef-repo/cookbooks/init-sdc-elasticsearch/recipes/ES_1_create_audit_template.rb
+++ b/sdc-os-chef/sdc-init-elasticsearch/chef-repo/cookbooks/init-sdc-elasticsearch/recipes/ES_1_create_audit_template.rb
@@ -1,8 +1,11 @@
+# Get the first es node in the list
+es_node = node['Nodes']['ES'].first
+
ruby_block "check_ElasticSearch_Cluster_Health" do
block do
#tricky way to load this Chef::Mixin::ShellOut utilities
Chef::Resource::RubyBlock.send(:include, Chef::Mixin::ShellOut)
- curl_command = "http://#{node['Nodes']['ES']}:9200/_cluster/health?pretty=true"
+ curl_command = "http://#{es_node}:9200/_cluster/health?pretty=true"
resp = Net::HTTP.get_response URI.parse(curl_command)
stat = JSON.parse(resp.read_body)['status']
@@ -233,13 +236,13 @@ bash "create audit mapping" do
},
"_all": { "enabled": true } }
},
- "aliases": { "last_3_months": {}}}' http://#{node['Nodes']['ES']}:9200/_template/audit_template
+ "aliases": { "last_3_months": {}}}' http://#{es_node}:9200/_template/audit_template
EOH
end
bash "set default index for Kibana" do
code <<-EOH
- curl -XPUT http://#{node['Nodes']['ES']}:9200/.kibana/index-pattern/auditingevents-* -d '{"title" : "events-*", "timeFieldName": "TIMESTAMP"}'
- curl -XPUT http://#{node['Nodes']['ES']}:9200/.kibana/config/4.3.3 -d '{"defaultIndex" : "auditingevents-*"}'
+ curl -XPUT http://#{es_node}:9200/.kibana/index-pattern/auditingevents-* -d '{"title" : "events-*", "timeFieldName": "TIMESTAMP"}'
+ curl -XPUT http://#{es_node}:9200/.kibana/config/4.3.3 -d '{"defaultIndex" : "auditingevents-*"}'
EOH
end
diff --git a/sdc-os-chef/sdc-init-elasticsearch/chef-repo/cookbooks/init-sdc-elasticsearch/recipes/ES_2_create_resources_template.rb b/sdc-os-chef/sdc-init-elasticsearch/chef-repo/cookbooks/init-sdc-elasticsearch/recipes/ES_2_create_resources_template.rb
index d35b81293e..11b8c9d060 100644
--- a/sdc-os-chef/sdc-init-elasticsearch/chef-repo/cookbooks/init-sdc-elasticsearch/recipes/ES_2_create_resources_template.rb
+++ b/sdc-os-chef/sdc-init-elasticsearch/chef-repo/cookbooks/init-sdc-elasticsearch/recipes/ES_2_create_resources_template.rb
@@ -1,8 +1,11 @@
+# Get the first es node in the list
+es_node = node['Nodes']['ES'].first
+
ruby_block "check_ElasticSearch_Cluster_Health" do
block do
#tricky way to load this Chef::Mixin::ShellOut utilities
Chef::Resource::RubyBlock.send(:include, Chef::Mixin::ShellOut)
- curl_command = "http://#{node['Nodes']['ES']}:9200/_cluster/health?pretty=true"
+ curl_command = "http://#{es_node}:9200/_cluster/health?pretty=true"
resp = Net::HTTP.get_response URI.parse(curl_command)
stat = JSON.parse(resp.read_body)['status']
@@ -32,6 +35,6 @@ bash "create resources mapping" do
"_all": { "enabled": true }
}
}
- }' http://#{node['Nodes']['ES']}:9200/_template/resources_template
+ }' http://#{es_node}:9200/_template/resources_template
EOH
end \ No newline at end of file
diff --git a/sdc-os-chef/sdc-init-elasticsearch/chef-repo/cookbooks/init-sdc-elasticsearch/recipes/ES_3_create_monitoring_template.rb b/sdc-os-chef/sdc-init-elasticsearch/chef-repo/cookbooks/init-sdc-elasticsearch/recipes/ES_3_create_monitoring_template.rb
index 02b20f8cce..685b468e7a 100644
--- a/sdc-os-chef/sdc-init-elasticsearch/chef-repo/cookbooks/init-sdc-elasticsearch/recipes/ES_3_create_monitoring_template.rb
+++ b/sdc-os-chef/sdc-init-elasticsearch/chef-repo/cookbooks/init-sdc-elasticsearch/recipes/ES_3_create_monitoring_template.rb
@@ -1,8 +1,11 @@
+# Get the first es node in the list
+es_node = node['Nodes']['ES'].first
+
ruby_block "check_ElasticSearch_Cluster_Health" do
block do
#tricky way to load this Chef::Mixin::ShellOut utilities
Chef::Resource::RubyBlock.send(:include, Chef::Mixin::ShellOut)
- curl_command = "http://#{node['Nodes']['ES']}:9200/_cluster/health?pretty=true"
+ curl_command = "http://#{es_node}:9200/_cluster/health?pretty=true"
resp = Net::HTTP.get_response URI.parse(curl_command)
stat = JSON.parse(resp.read_body)['status']
@@ -48,6 +51,6 @@ bash "create monitoring mapping" do
}
},
"aliases": { "last_3_months": {} }
- }' http://#{node['Nodes']['ES']}:9200/_template/monitoring_template
+ }' http://#{es_node}:9200/_template/monitoring_template
EOH
end
diff --git a/sdc-os-chef/sdc-init-elasticsearch/chef-repo/cookbooks/init-sdc-elasticsearch/recipes/ES_4_create_kibana_dashboard_virtualization.rb b/sdc-os-chef/sdc-init-elasticsearch/chef-repo/cookbooks/init-sdc-elasticsearch/recipes/ES_4_create_kibana_dashboard_virtualization.rb
index 08c3fac613..53497133f5 100644
--- a/sdc-os-chef/sdc-init-elasticsearch/chef-repo/cookbooks/init-sdc-elasticsearch/recipes/ES_4_create_kibana_dashboard_virtualization.rb
+++ b/sdc-os-chef/sdc-init-elasticsearch/chef-repo/cookbooks/init-sdc-elasticsearch/recipes/ES_4_create_kibana_dashboard_virtualization.rb
@@ -1,8 +1,11 @@
+# Get the first es node in the list
+es_node = node['Nodes']['ES'].first
+
ruby_block "check_ElasticSearch_Cluster_Health" do
block do
#tricky way to load this Chef::Mixin::ShellOut utilities
Chef::Resource::RubyBlock.send(:include, Chef::Mixin::ShellOut)
- curl_command = "http://#{node['Nodes']['ES']}:9200/_cluster/health?pretty=true"
+ curl_command = "http://#{es_node}:9200/_cluster/health?pretty=true"
resp = Net::HTTP.get_response URI.parse(curl_command)
stat = JSON.parse(resp.read_body)['status']
@@ -25,7 +28,7 @@ bash "create Kibana dashboard" do
for file in /root/chef-solo/cookbooks/sdc-init-elasticsearch/files/default/dashboard_*.json; do
name=`basename $file .json | awk -F"_" '{print $2}'`
echo "Loading dashboard $name:"
- curl -XPUT http://#{node['Nodes']['ES']}:9200/.kibana/dashboard/$name -d @$file || exit 1
+ curl -XPUT http://#{es_node}:9200/.kibana/dashboard/$name -d @$file || exit 1
echo
done
EOH
@@ -36,7 +39,7 @@ bash "create Kibana visualization" do
for file in /root/chef-solo/cookbooks/sdc-init-elasticsearch/files/default/visualization_*.json; do
name=`basename $file .json | awk -F"_" '{print $2}'`
echo "Loading visualization $name:"
- curl -XPUT http://#{node['Nodes']['ES']}:9200/.kibana/visualization/$name -d @$file || exit 1
+ curl -XPUT http://#{es_node}:9200/.kibana/visualization/$name -d @$file || exit 1
echo
done
EOH