我想使用Ansible在我的VPS上安裝Bundler。使用Ansible安裝Bundler gem
我已經有rbenv設置和全球紅寶石2.1.0。
如果我以root身份進入服務器並運行gem install bundler
,它會完美安裝。
我試過以下三種使用Ansible來安裝Bundler gem的方式,並且所有三種方式都不會產生錯誤,但是當我SSH進入並運行gem list
時,Bundler無處可見。
嘗試1:
---
- name: Install Bundler
shell: gem install bundler
嘗試2:
---
- name: Install Bundler
shell: gem install bundler
嘗試3:
---
- name: Install Bundler
gem: name=bundler
state=latest
我也試圖在最後一次嘗試與user_install=yes
並與user_install=no
也不做任何差異。
任何想法如何讓它通過Ansible正確安裝Bundler?
我一直在爲此工作了一小會兒,並且安裝了1個ruby版本:2.1.0和ahve發現rbenv的shim目錄不包含bundle
的墊片。
bundle
應該放在哪裏?我只是感到困惑,爲什麼capistrano無法找到bundle
命令,因爲它在我運行sudo gem list
時列出,但不是當我運行gem list
時?
[email protected]:/usr/local/rbenv/shims# echo $PATH
/usr/local/rbenv/shims:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
[email protected]:/usr/local/rbenv/shims# gem environment
RubyGems Environment:
- RUBYGEMS VERSION: 2.2.0
- RUBY VERSION: 2.1.0 (2013-12-25 patchlevel 0) [x86_64-linux]
- INSTALLATION DIRECTORY: /usr/local/rbenv/versions/2.1.0/lib/ruby/gems/2.1.0
- RUBY EXECUTABLE: /usr/local/rbenv/versions/2.1.0/bin/ruby
- EXECUTABLE DIRECTORY: /usr/local/rbenv/versions/2.1.0/bin
- SPEC CACHE DIRECTORY: /root/.gem/specs
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /usr/local/rbenv/versions/2.1.0/lib/ruby/gems/2.1.0
- /root/.gem/ruby/2.1.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- :sources => ["http://gems.rubyforge.org", "http://gems.github.com"]
- "gem" => "--no-ri --no-rdoc"
- REMOTE SOURCES:
- http://gems.rubyforge.org
- http://gems.github.com
- SHELL PATH:
- /usr/local/rbenv/versions/2.1.0/bin
- /usr/local/rbenv/libexec
- /usr/local/rbenv/shims
- /usr/local/sbin
- /usr/local/bin
- /usr/sbin
- /usr/bin
- /sbin
- /bin
- /usr/games
任何想法?
所以,我覺得這兩個主要問題,我有:
爲什麼捆綁唯一可見的,當我運行
sudo gem list
?我的部署是在說:
INFO [18d5838c] Running /usr/bin/env bundle install --binstubs /var/rails_apps/neiltonge/shared/bin --path /var/rails_apps/neiltonge/shared/bundle --without development test --deployment --quiet on 188.226.159.96 DEBUG [18d5838c] Command: cd /var/rails_apps/neiltonge/releases/20140301205432 && (PATH=$PATH /usr/bin/env bundle install --binstubs /var/rails_apps/neiltonge/shared/bin --path /var/rails_apps/neiltonge/shared/bundle --without development test --deployment --quiet) DEBUG [18d5838c] /usr/bin/env: bundle: No such file or directory
,這是我
$PATH
:/usr/local/rbenv/shims:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
爲什麼不能捆放置在何處?
右鍵我發現運行'gem list'不顯示Bundler而是'sudo gem list'!爲什麼是這個,以及Capistrano能夠使用它的地方? – rctneil