My pull request has been merged.
I'm using itamae for provisioning some servers. However, I don't have
sudo
access. Here's how I stopped itamae from using sudo
.diff --git a/lib/itamae/backend.rb b/lib/itamae/backend.rb
index d4f6e35..25bab62 100644
--- a/lib/itamae/backend.rb
+++ b/lib/itamae/backend.rb
@@ -33,6 +33,7 @@ module Itamae
when :ssh
Specinfra.configuration.request_pty = true
Specinfra.configuration.host = options.delete(:host)
+ Specinfra.configuration.disable_sudo = options.delete(:disable_sudo)
Specinfra.configuration.ssh_options = options
Specinfra.configuration.backend = :ssh
diff --git a/lib/itamae/cli.rb b/lib/itamae/cli.rb
index 8c40fe9..544a0e0 100644
--- a/lib/itamae/cli.rb
+++ b/lib/itamae/cli.rb
@@ -35,6 +35,7 @@ module Itamae
option :ohai, type: :boolean, default: false
option :vagrant, type: :boolean, default: false
option :ask_password, type: :boolean, default: false
+ option :sudo, type: :boolean, default: true
def ssh(*recipe_files)
if recipe_files.empty?
raise "Please specify recipe files."
diff --git a/lib/itamae/runner.rb b/lib/itamae/runner.rb
index 37908fc..3a5c96d 100644
--- a/lib/itamae/runner.rb
+++ b/lib/itamae/runner.rb
@@ -54,6 +54,7 @@ module Itamae
opts[:user] = options[:user] || Etc.getlogin
opts[:keys] = [options[:key]] if options[:key]
opts[:port] = options[:port] if options[:port]
+ opts[:disable_sudo] = true unless options[:sudo]
if options[:vagrant]
config = Tempfile.new('', Dir.tmpdir)
This can be applied to a bundled itamae as follows.
#!/bin/bash
DIR=$(dirname "$0")
bundle install --path "$DIR/vendor/bundle"
# itamaeのno sudoパッチを当てる
pushd vendor/bundle/ruby/2.1.0/gems/itamae-1.0.4/lib/itamae &>/dev/null
patch <../../../../../../../../itamae-1.0.4-no-sudo.patch
popd &>/dev/null
Then, to use it... (I couldn't get --no-sudo to work)
bundle exec itamae ssh -h server -u user --sudo=false recipes/recipe.rb