Created
May 30, 2016 10:52
-
-
Save arvindvyas/eac5104a07835ae1a435de66e1df1027 to your computer and use it in GitHub Desktop.
cap task to install, start , restart and stop elasticsearch in server
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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