Capistrano-sudo

Capistrano plugin for sudo operation with password input.

Requirements

  • Capistrano ~> 3.3

Installation

Add this line to your application's Gemfile:

gem 'capistrano'
gem 'capistrano-sudo'

And then execute:

$ bundle install

Configuration

You can also Capistrano variables with set name, value.

Name Default Description
password ENV['SUDO_PASSWORD'] target machine's sudo password

Usage

Add this line to your application's Capfile:

require 'capistrano/sudo'

And use the sudo! DSL in your task:

task :something do
  on roles(:all) do |host|
    sudo! :mkdir, '/foo/bar'
  end
end

And execute cap command with sudo password, like this:

% SUDO_PASSWORD=<sudopass> bundle exec cap production deploy

Contributing

  1. Fork it ( https://github.com/[my-github-username]/capistrano-sudo/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request