Puppet与Apache集成但无法启动应有的ruby

时间:2017-02-12 12:07:43

标签: ruby-on-rails ruby apache passenger puppet

我已根据官方文档安装了Puppet,并且已经安装了Ruby 1.8.7。

但是通过rvm我已经安装了ruby 2.3.3,然后用gem install rack passenger安装了机架和乘客宝石并成功安装了passenger-install-apache2-module

我对puppetmaster.conf进行了相应的更改,并将其放在httpd服务的conf.d目录中。

启动httpd服务后,我提供了puppet cert并显示错误

[root@lab puppet-fundamentals-puppetmaster]# puppet cert
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- json (L
oadError)
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from /usr/lib/ruby/site_ruby/1.8/puppet/module.rb:3
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from /usr/lib/ruby/site_ruby/1.8/puppet/parser/files.rb:1
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from /usr/lib/ruby/site_ruby/1.8/puppet/parser/templatewrapper.rb:1
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from /usr/lib/ruby/site_ruby/1.8/puppet/parser/scope.rb:6
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from /usr/lib/ruby/site_ruby/1.8/puppet/parser/methods.rb:2
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from /usr/lib/ruby/site_ruby/1.8/puppet/parser/ast/method_call.rb:2
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from /usr/lib/ruby/site_ruby/1.8/puppet/parser/ast.rb:115
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from /usr/lib/ruby/site_ruby/1.8/puppet/parser/parser.rb:11
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from /usr/lib/ruby/site_ruby/1.8/puppet/parser.rb:4
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from /usr/lib/ruby/site_ruby/1.8/puppet.rb:282
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from /usr/lib/ruby/site_ruby/1.8/puppet/util/command_line.rb:12
        from /usr/bin/puppet:7:in `require'

我不明白为什么Puppet仍在查看ruby 1.8,即使我在puppetmaster.conf中提到过

     PassengerRoot /usr/local/rvm/gems/ruby-2.3.3/gems/passenger-5.1.2
     PassengerDefaultRuby /usr/local/rvm/gems/ruby-2.3.3/wrappers/ruby 

有什么办法可以告诉Puppet将ruby-2.3.3作为默认ruby来满足它的所有需求吗?

[root@lab ~]# puppet --version
3.8.7
[root@lab ~]#

[root@lab ~]# ruby -v                                                      
ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-linux]                  

[root@lab ~]# rvm all ruby list                                            

rvm rubies                                                                 

=* ruby-2.3.3 [ x86_64 ]               

谢谢。

2 个答案:

答案 0 :(得分:0)

尝试创建包装器,请参阅https://rvm.io/deployment/god

rvm wrapper ruby@gemset [scope] [binary-name]

答案 1 :(得分:0)

尝试使用PassengerRuby代替PassengerDefaultRuby