Run itamae in capistrano task
Add this line to your application's Gemfile:
group :development do
gem "capistrano-itamae", require: false
end
And then execute:
$ bundle
Or install it yourself as:
$ gem install capistrano-itamae
Capfile
require "capistrano/itamae"
config/deploy.rb
set :itamae_cookbooks_path, "cookbooks"
set :itamae_ssh_default_options, "--node-yaml=node.yml"
desc "Run itamae"
task :itamae do
on roles(:all) do
# Run itamae ssh --node-yaml=node.yml cookbooks/default.rb
itamae_ssh
# Run itamae ssh --node-yaml=node.yml cookbooks/recipe.rb
itamae_ssh "recipe.rb"
# Run itamae ssh --node-yaml=node.yml cookbooks/recipe1.rb cookbooks/recipe2.rb
itamae_ssh ["recipe1.rb", "recipe2.rb"]
# Run itamae ssh --node-yaml=node.yml cookbooks/recipe.rb --no-sudo --log-level=debug
itamae_ssh "recipe.rb", options: "--no-sudo --log-level=debug"
# Pass $PATH to `itamae ssh`
itamae_ssh "recipe.rb", environment: { path: ENV["PATH"] }
end
end
end
# Run itamae ssh --dry-run 〜
$ bundle exec cap --dry-run 〜
# Run itamae ssh 〜
$ bundle exec cap 〜
see Capistrano::Itamae::DSL#itamae_ssh
itamae_cookbooks_path
: path to cookbooks dir (default:"cookbooks"
)itamae_bin_name
: itamae executable name (default:"itamae"
)itamae_ssh_default_options
:itamae ssh
default options (default: empty)
After checking out the repo, run bin/setup
to install dependencies. You can also run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
, which will create a git tag for the version, push git commits and tags, and push the .gem
file to rubygems.org.
cd spec/integration
docker image build . -t ssh_server
docker run -d -p 10000:22 ssh_server
bundle exec rake spec
Bug reports and pull requests are welcome on GitHub at https://github.com/sue445/capistrano-itamae.
The gem is available as open source under the terms of the MIT License.