Skip to content

Instantly share code, notes, and snippets.

@arvindvyas
Created May 30, 2016 10:52
Show Gist options
  • Save arvindvyas/eac5104a07835ae1a435de66e1df1027 to your computer and use it in GitHub Desktop.
Save arvindvyas/eac5104a07835ae1a435de66e1df1027 to your computer and use it in GitHub Desktop.
cap task to install, start , restart and stop elasticsearch in server
namespace :elasticsearch do
desc "Install elasticsearch"
task :install do
on roles(:app) do
execute "sudo apt-get update"
execute "sudo apt-get install openjdk-7-jre-headless -y"
execute "cd /tmp"
execute "wget https://download.elasticsearch.org/elasticsearch\
/elasticsearch/elasticsearch-2.3.2.deb"
execute "sudo dpkg -i elasticsearch-2.3.2.deb"
end
end
end
namespace :elasticsearch do
desc "start elasticsearch"
task :start do
on roles(:app) do
execute "sudo service elasticsearch start"
end
end
end
namespace :elasticsearch do
desc "restart elasticsearch"
task :restart do
on roles(:app) do
execute "sudo service elasticsearch restart"
end
end
end
namespace :elasticsearch do
desc "stop elasticsearch"
task :stop do
on roles(:app) do
execute "sudo service elasticsearch stop"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment