Skip to content
This repository has been archived by the owner on Jul 26, 2023. It is now read-only.

Commit

Permalink
Add Bash block to remove the .wazuh index and configure wazuh.yml file
Browse files Browse the repository at this point in the history
  • Loading branch information
Jose M committed Dec 30, 2019
1 parent db1b507 commit 0cdeba6
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions cookbooks/wazuh_elastic/recipes/kibana.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,36 @@
end
end

bash 'Removing .wazuh index if exists' do
code <<-EOH
curl_response=$(curl -s -XDELETE -sL -w "%{http_code}" -I "http://#{node['wazuh-elastic']['elasticsearch_ip']}:#{node['wazuh-elastic']['elasticsearch_port']}/.wazuh" -o /dev/null)
if [ ${curl_response} == 404 ]
then
echo "Index .wazuh not found"
elif [ ${curl_response} == 200 ]
then
echo "Index .wazuh removed successfully"
else
echo "Unable to communicate with Elasticsearch API"
fi
EOH
end

template 'Configuring API credentials in wazuh.yml file' do
path '/usr/share/kibana/plugins/wazuh/wazuh.yml'
source 'wazuh.yml.erb'
owner 'kibana'
group 'root'
mode 0644
notifies :restart, "service[kibana]", :delayed
end

bash 'Verify Kibana folders owner' do
code <<-EOF
chown -R kibana:kibana /usr/share/kibana/optimize
chown -R kibana:kibana /usr/share/kibana/plugins
EOF
end


end

0 comments on commit 0cdeba6

Please sign in to comment.