通过厨师安装RVM /红宝石1.9.3红宝石、厨师、RVM

2023-09-11 09:43:21 作者:不唸過去不畏將來

我刚刚开始,试图将我的基础设施交给厨师,我想我一定是失去了一些东西明显。

I'm just getting started with trying to move my infrastructure over to Chef, and I think I must be missing something obvious.

我使用的是厨师RVM 食谱安装RVM,我想它安装Ruby 1.9.3p125,并设置为默认值。

I'm using the chef-rvm cookbook to install RVM, and I'd like it to install Ruby 1.9.3p125 and set that as the default.

这是我的基本服务器角色:

Here's my base server role:

name "base"
description "Basic configuration for all nodes"
run_list(
  'recipe[git]',
  'recipe[sudo]',
  'recipe[ubuntu]',
  'recipe[rvm]',
  'recipe[postgresql::client]'
)

override_attributes(
  :authorization => {
    :sudo => {
      :users => ["ubuntu"],
      :passwordless => true
    }
  },
  :rvm => {
    :rubies => ["ruby-1.9.3-p125"],
    :default_ruby => "ruby-1.9.3-p125",
    :global_gems => ['bundler', 'rake']
  }
)

这个运行没有任何问题,但如果我ssh到服务器,它的完成后,RVM没有列出任何安装红宝石:

This runs without any problems, but if I ssh into the server after it's finished, rvm doesn't list any installed rubies:

ubuntu@test.server:~$ rvm list

rvm rubies


# No rvm rubies installed yet. Try 'rvm help install'.

这甚至指定要安装某些红宝石的正确方法?如果没有,什么是正确的方法是什么?如果是的话,我究竟哪里做错了?

Is this even the correct way to specify that certain rubies be installed? If not, what is the correct way? If so, what am I doing wrong?

推荐答案

这没有什么不对您code。问题在于,你从来没有告诉过厨师安装您在角色中定义的红宝石。

There's nothing wrong with your code. The problem lies in the fact that you never told Chef to install the Rubies that you defined in your role.

您已经包括配方[RVM] 中的作用的 run_list ,相当于食谱[RVM ::默认] 。展望菜谱的文档,你会发现这个食谱:

You have included recipe[rvm] in the role's run_list, which translates to recipe[rvm::default]. Looking into the cookbook's documentation, you find that this recipe:

安装RVM创业板和初始化厨师使用轻型资源和供应商(LWRPs)。的使用这个配方明确,如果你只是想访问所提供的LWRPs。

您想通过替换,可以最好地实现什么配方[RVM] 配方[RVM ::系统] run_list

What you want can be best achieved by substituting recipe[rvm] for recipe[rvm::system] in the run_list:

安装RVM codeBase的系统级(即到/ usr /本地/ RVM),并安装红宝石,全球宝石,和具体的宝石击退属性的元数据。这个配方包括默认和系统 _ 安装。的 本身,如果你想RVM全系统的安装红宝石使用这个配方等。

 
精彩推荐