我试图在Ubuntu12.04上运行带有nginx的客服web服务器的安装,使用Ansible 1.4.1,因为ansible找不到命令,所以宝石安装似乎搞砸了,而且当我手工重新安装gem时,它就可以工作了。我做错了什么?
# ruby.yml
- name: "install ruby"
script: scripts/install_ruby.sh
- name: "Install bundler"
gem: name=bundler state=latest
- name: "Install passenger"
gem: name=passenger state=latest
- name: "Copy nginx upstart"
copy: src=nginx.conf dest=/etc/init/nginx.conf mode=0644 owner=root group=root
- name: Install passenger-nginx
command: passenger-install-nginx-module --auto-download --auto --prefix=/opt/nginx --extra-configure-flags='--with-http_gzip_static_module --with-http_secure_link_module --with-http_realip_module --with-http_ssl_module' creates=/opt/nginx
- name: "Enable Nginx"
service: name=nginx state=started enabled=yes错误:
TASK: [common | install ruby] *************************************************
changed: [staging-2.coinvalley.com]
TASK: [common | Install bundler] **********************************************
ok: [staging-2.coinvalley.com]
TASK: [common | Install passenger] ********************************************
ok: [staging-2.coinvalley.com]
TASK: [common | Copy nginx upstart] *******************************************
ok: [staging-2.coinvalley.com]
TASK: [common | Install passenger-nginx] **************************************
failed: [staging-2.coinvalley.com] => {"cmd": ["passenger-install-nginx-module", "--auto-download", "--auto", "--prefix=/opt/nginx", "--extra-configure-flags=--with-http_gzip_static_module --with-http_secure_link_module --with-http_realip_module --with-http_ssl_module"], "failed": true, "item": "", "rc": 2}
msg: [Errno 2] No such file or directory
FATAL: all hosts have already failed -- aborting当我进去的时候,我看到了宝石的存在:
root@staging 2:~# gem列表
*** LOCAL GEMS ***
bigdecimal (1.2.3)
bundler (1.5.2)
daemon_controller (1.1.8)
io-console (0.4.2)
json (1.8.1)
minitest (4.7.5)
passenger (4.0.36)
psych (2.0.2)
rack (1.5.2)
rake (10.1.0)
rdoc (4.1.0)
test-unit (2.1.0.0)但是,当我尝试运行install命令时,它仍然无法工作:
root@staging-2:~# passenger-install-nginx-module
passenger-install-nginx-module: command not found只有当我重新运行:
gem install passengerRuby是从源代码中安装的,下面是我的gem env
root@staging-2:~# gem env
RubyGems Environment:
- RUBYGEMS VERSION: 2.2.0
- RUBY VERSION: 2.1.0 (2013-12-25 patchlevel 0) [x86_64-linux]
- INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/2.1.0
- RUBY EXECUTABLE: /usr/local/bin/ruby
- EXECUTABLE DIRECTORY: /usr/local/bin
- SPEC CACHE DIRECTORY: /root/.gem/specs
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /usr/local/lib/ruby/gems/2.1.0
- /root/.gem/ruby/2.1.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /usr/local/sbin
- /usr/local/bin
- /usr/sbin
- /usr/bin
- /sbin
- /bin
- /usr/games我看到了创业板路径目录中的可执行文件:
- /root/.gem/ruby/2.1.0但很明显这不是加到主干道上的?
Ansible的gem模块会在幕后使用-用户-安装选项吗?
好吧,显然是:Module.html#宝石-管理-红宝石-宝石
把问题留给其他人参考
发布于 2014-01-27 21:39:53
既然你在Ubuntu上,只需使用Ansible通过apt-get安装Phusion旅客Debian包裹 (单击"Ubuntu")即可。它的工作原理与apt完全一样,它比使用RubyGems安装简单得多,甚至为您安装所有必要的依赖项(包括Ruby本身!)
发布于 2014-01-27 20:50:18
中断,因为Ansible现在默认使用user_install选项来安装gem,从Ansible 1.3开始
Module.html#宝石-管理-红宝石-宝石
-用户-安装选项
https://stackoverflow.com/questions/21390904
复制相似问题