Find file
Fetching contributors…
Cannot retrieve contributors at this time
31 lines (25 sloc) 965 Bytes
# Install ElasticSearch plugin
#
define :install_plugin do
bash "/usr/local/bin/plugin -install #{node.elasticsearch[:plugin][params[:name].intern][:url]}" do
user "root"
code "/usr/local/bin/plugin -install #{node.elasticsearch[:plugin][params[:name].intern][:url]}"
notifies :restart, resources(:service => 'elasticsearch')
not_if do
begin
Dir.entries("#{node.elasticsearch[:dir]}/elasticsearch-#{node.elasticsearch[:version]}/plugins/").any? do |entry|
begin
puts "Does #{entry} match the plugin name for #{params[:name]} ???"
puts node.elasticsearch[:plugin][params[:name].intern][:name].eql? entry
node.elasticsearch[:plugin][params[:name].intern][:name].eql? entry
rescue
false
end
end
rescue
puts "No plugins have been installed yet, even the plugins directory doesn't exist..."
false
end
end
end
end