如果我尝试使用knife ssh
,就会遇到此错误:
knife ssh my-node-name.com 'sudo chef-client'
...
STDERR: ERROR: Error installing newrelic_resque_agent: redis requires Ruby version >= 2.2.2.
但是,如果我以myuser身份登录到计算机,则sudo chef-client
可以工作。我发现这是因为红宝石二进制文件不同:
knife ssh my-node-name.com 'whoami && sudo which ruby && ruby --version && echo $PATH'
myuser
/usr/bin/ruby
ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux]
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
现在,如果我以myuser身份登录my-node-name.com并运行whoami && sudo which ruby && ruby --version && echo $PATH
myuser
/usr/local/rvm/rubies/ruby-2.3.5/bin/ruby
ruby 2.3.5p376 (2017-09-14 revision 59905) [x86_64-linux]
/usr/local/rvm/gems/ruby-2.3.5/bin:/usr/local/rvm/gems/ruby-2.3.5@global/bin:/usr/local/rvm/rubies/ruby-2.3.5/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/local/rvm/bin
我正在使用chef-client --version
=> Chef: 12.12.15
如何使knife ssh
工作?