1 # Get the first es node in the list
2 es_node = node['Nodes']['ES'].first
4 ruby_block "check_ElasticSearch_Cluster_Health" do
6 #tricky way to load this Chef::Mixin::ShellOut utilities
7 Chef::Resource::RubyBlock.send(:include, Chef::Mixin::ShellOut)
8 curl_command = "http://#{es_node}:9200/_cluster/health?pretty=true"
9 resp = Net::HTTP.get_response URI.parse(curl_command)
10 stat = JSON.parse(resp.read_body)['status']
14 printf("\033[32m%s\n\033[0m", " ElasticSearch Cluster status is green.")
16 printf("\033[33m%s\n\033[0m", " ElasticSearch Cluster status is yellow...")
18 printf("\033[31m%s\n\033[0m", " ElasticSearch Cluster status is red!")
26 bash "create resources mapping" do
28 curl -i -X PUT -d '{ "order": 1, "template": "resources", "settings": {}, "mappings":
32 "id": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
33 "data": { "include_in_all": false, "type": "string" }
35 "_all": { "enabled": true }
38 }' http://#{es_node}:9200/_template/resources_template