如何与厨师安装Redis?

我正在尝试与厨师安装Redis。 我想,这很容易,因为我只想要默认configuration。

所以,我添加到一个Berksfile:

网站:opscode

食谱“apt”
菜谱“节点”
 cookbook'rvm',:git =>“https://github.com/fnichol/chef-rvm”
菜谱“runit”
食谱“redis

然后,我运行:stream浪汉提供

但是我得到这个:

 2013-12-11T21:18:23 + 00:00] DEBUG:chef_gem [rvm]已经安装 - 无事可做
 [2013-12-11T21:18:23 + 00:00] DEBUG:加载配方rvm :: vagrant via include_recipe
 [2013-12-11T21:18:23 + 00:00] DEBUG:在食谱rvmfindstream浪食谱
 [2013-12-11T21:18:23 + 00:00]警告:从先前资源(CHEF-3694)克隆组[rvm]的资源属性
 [2013-12-11T21:18:23 + 00:00]警告:上一组[rvm]:/tmp/vagrant-chef-1/chef-solo-1/cookbooks/rvm/recipes/system.rb:33:在`from_file'
 [2013-12-11T21:18:23 + 00:00]警告:当前组[rvm]:/tmp/vagrant-chef-1/chef-solo-1/cookbooks/rvm/recipes/vagrant.rb:34:在`from_file'
 [2013-12-11T21:18:23 + 00:00] DEBUG:通过include_recipe加载配方redis
 [2013-12-11T21:18:23 + 00:00] DEBUG:在食谱redis中发现食谱默认
 [2013-12-11T21:18:23 + 00:00] DEBUG:通过include_recipe加载配方metachef
 [2013-12-11T21:18:23 + 00:00] DEBUG:在食谱metachef中find食谱默认
 [2013-12-11T21:18:23 + 00:00] DEBUG:通过include_recipe加载食谱redis :: server
 [2013-12-11T21:18:23 + 00:00] DEBUG:在cookbook redis中find配方服务器
 [2013-12-11T21:18:23 + 00:00] DEBUG:通过include_recipe载入配方runit
 [2013-12-11T21:18:23 + 00:00] DEBUG:在cookbook runit中find食谱默认值
 [2013-12-11T21:18:23 + 00:00] DEBUG:通过include_recipe加载配方metachef
 [2013-12-11T21:18:23 + 00:00] DEBUG:我没有加载metachef,因为我已经看过了。
 [2013-12-11T21:18:23 + 00:00] DEBUG:加载配方redis :: default via include_recipe
 [2013-12-11T21:18:23 + 00:00] DEBUG:我没有加载redis :: default,因为我已经看到了。
 [2013-12-11T21:18:23 + 00:00]警告:从先前资源(CHEF-3694)克隆目录[/ etc / redis]的资源属性
 [2013-12-11T21:18:23 + 00:00]警告:上一个目录[/ etc / redis]:/tmp/vagrant-chef-1/chef-solo-1/cookbooks/metachef/definitions/standard_dirs.rb :44:在'from_file'块(3级)
 [2013-12-11T21:18:23 + 00:00] WARN:当前目录[/ etc / redis]:/tmp/vagrant-chef-1/chef-solo-1/cookbooks/metachef/definitions/standard_dirs.rb :44:在'from_file'块(3级)
 [2013-12-11T21:18:23 + 00:00] DEBUG:过滤编译错误的回溯:/tmp/vagrant-chef-1/chef-solo-1/cookbooks/redis/recipes/server.rb:37: / tmp / vagrant-chef-1 / chef-solo-1 / cookbooks / redis / recipes / server.rb:36:in`from_file'
 [2013-12-11T21:18:23 + 00:00] DEBUG:过滤编译错误的回溯:/tmp/vagrant-chef-1/chef-solo-1/cookbooks/redis/recipes/server.rb:37: / tmp / vagrant-chef-1 / chef-solo-1 / cookbooks / redis / recipes / server.rb:36:in`from_file'
 [2013-12-11T21:18:23 + 00:00] DEBUG:回溯编译错误:'/tmp/vagrant-chef-1/chef-solo-1/cookbooks/redis/recipes/server.rb:37 :在`from_file'块中'
 [2013-12-11T21:18:23 + 00:00] DEBUG:编译错误行号:'37'
 [2013-12-11T21:18:23 + 00:00] DEBUG:重新抛出exception:NoMethodError  -  Chef :: Resource :: RunitService的未定义方法run_state
 /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.8.2/lib/chef/resource.rb:294:in`method_missing'
   /tmp/vagrant-chef-1/chef-solo-1/cookbooks/redis/recipes/server.rb:37:in`block from from_file'
   /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.8.2/lib/chef/dsl/recipe.rb:71:in`instance_eval'
   /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.8.2/lib/chef/dsl/recipe.rb:71:in`method_missing'
   /tmp/vagrant-chef-1/chef-solo-1/cookbooks/redis/recipes/server.rb:36:in`from_file'
   /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.8.2/lib/chef/mixin/from_file.rb:30:in`instance_eval'
   /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.8.2/lib/chef/mixin/from_file.rb:30:in`from_file'
   /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.8.2/lib/chef/cookbook_version.rb:237:in`load_recipe'
   /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.8.2/lib/chef/run_context.rb:151:in`load_recipe'
   /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.8.2/lib/chef/run_context/cookbook_compiler.rb:139:in`block in compile_recipes'
   /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.8.2/lib/chef/run_context/cookbook_compiler.rb:137:in`each'
   /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.8.2/lib/chef/run_context/cookbook_compiler.rb:137:in`compile_recipes'
   /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.8.2/lib/chef/run_context/cookbook_compiler.rb:74:in`compile'
   /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.8.2/lib/chef/run_context.rb:86:in`load'
   /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.8.2/lib/chef/client.rb:250:in`setup_run_context'
   /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.8.2/lib/chef/client.rb:498:in`do_run'
  在/ run / block / run /
   /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.8.2/lib/chef/client.rb:193:in`fork'
   /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.8.2/lib/chef/client.rb:193:in`run'
  在/ run / install /
   /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.8.2/lib/chef/application/solo.rb:221:in`block in run_application'
   /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.8.2/lib/chef/application/solo.rb:213:in`loop'
  在/ run /应用程序/
   /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.8.2/lib/chef/application.rb:66:in`run'
   /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.8.2/bin/chef-solo:25:in`'
   / opt / chef / bin / chef-solo:23:在`load'
   / opt / chef / bin / chef-solo:23:在``
 [2013-12-11T21:18:23 + 00:00]错误:运行exception处理程序
 [2013-12-11T21:18:23 + 00:00]错误:exception处理程序完成
 [2013-12-11T21:18:23 + 00:00]致命:Stacktrace转储到/var/chef/cache/chef-stacktrace.out
 [2013-12-11T21:18:23 + 00:00] DEBUG:NoMethodError:未定义的方法run_state for Chef :: Resource :: RunitService
 /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.8.2/lib/chef/resource.rb:294:in`method_missing'
 /tmp/vagrant-chef-1/chef-solo-1/cookbooks/redis/recipes/server.rb:37:in`block from from_file'
 /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.8.2/lib/chef/dsl/recipe.rb:71:in`instance_eval'
 /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.8.2/lib/chef/dsl/recipe.rb:71:in`method_missing'
 /tmp/vagrant-chef-1/chef-solo-1/cookbooks/redis/recipes/server.rb:36:in`from_file'
 /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.8.2/lib/chef/mixin/from_file.rb:30:in`instance_eval'
 /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.8.2/lib/chef/mixin/from_file.rb:30:in`from_file'
 /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.8.2/lib/chef/cookbook_version.rb:237:in`load_recipe'
 /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.8.2/lib/chef/run_context.rb:151:in`load_recipe'
 /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.8.2/lib/chef/run_context/cookbook_compiler.rb:139:in`block in compile_recipes'
 /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.8.2/lib/chef/run_context/cookbook_compiler.rb:137:in`each'
 /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.8.2/lib/chef/run_context/cookbook_compiler.rb:137:in`compile_recipes'
 /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.8.2/lib/chef/run_context/cookbook_compiler.rb:74:in`compile'
 /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.8.2/lib/chef/run_context.rb:86:in`load'
 /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.8.2/lib/chef/client.rb:250:in`setup_run_context'
 /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.8.2/lib/chef/client.rb:498:in`do_run'
在/ run / block / run /
 /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.8.2/lib/chef/client.rb:193:in`fork'
 /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.8.2/lib/chef/client.rb:193:in`run'
在/ run / install /
 /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.8.2/lib/chef/application/solo.rb:221:in`block in run_application'
 /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.8.2/lib/chef/application/solo.rb:213:in`loop'
在/ run /应用程序/
 /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.8.2/lib/chef/application.rb:66:in`run'
 /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.8.2/bin/chef-solo:25:in`'
 / opt / chef / bin / chef-solo:23:在`load'
 / opt / chef / bin / chef-solo:23:在``
 [2013-12-11T21:18:23 + 00:00]错误:Chef :: Resource :: RunitService的未定义方法`run_state'

 ================================================== ==============================
 /tmp/vagrant-chef-1/chef-solo-1/cookbooks/redis/recipes/server.rb中的配方编译错误
 ================================================== ==============================


 NoMethodError
 -------------
未定义的方法`run_state'为Chef :: Resource :: RunitService


食谱跟踪:
 ---------------
   /tmp/vagrant-chef-1/chef-solo-1/cookbooks/redis/recipes/server.rb:37:in`block from from_file'
   /tmp/vagrant-chef-1/chef-solo-1/cookbooks/redis/recipes/server.rb:36:in`from_file'


相关文件内容:
 ----------------------
 /tmp/vagrant-chef-1/chef-solo-1/cookbooks/redis/recipes/server.rb:

  30:standard_dirs('redis.server')这样做
  31:目录:conf_dir,:log_dir,:data_dir
  32:结束
  33:
  34:kill_old_service('redis-server'){only_if {File.exists?(“/ etc / init.d / redis-server”)}}
  35:
  36:runit_service“redis_server”呢
  37 >> run_state节点[:redis] [:server] [:run_state]
  38:选项节点[:redis]
  39:结束
  40:
  41:宣布(:redis,:服务器,
  42::port => node [:redis] [:server] [:port])
  43:


 [2013-12-11T21:18:21 + 00:00]信息:分叉厨师实例融合...
 [2013-12-11T21:18:21 + 00:00] DEBUG:叉子成功。 等待新厨师pid:28235
 [2013-12-11T21:18:23 + 00:00]致命错误:厨师::exception:: ChildConvergeError:厨师运行过程退出失败(退出代码1)

编辑 –

这是运行列表:

   config.vm.provision:chef_solo do | chef |
     chef.cookbooks_path =“./cookbooks”
     #chef.roles_path =“../my-recipes/roles”
     #chef.data_bags_path =“../my-recipes/data_bags”
     chef.add_recipe“runit”
     chef.add_recipe“rvm :: system”
     chef.add_recipe“rvm :: vagrant”
     chef.add_recipe“redis :: install_from_release”
     chef.add_recipe“redis :: client”
     #chef.add_recipe“节点”
     #chef.add_role“web”

     #你也可以指定自定义的JSON属性:
     chef.json = { 
       'rvm'=> {
          'rubies'=> [“2.0.0-p353”],
          'default_ruby'=>“2.0.0-p353”,
          :vagrant => {:system_chef_solo =>“/ opt / chef / bin / chef-solo”}
       }
     }

     chef.log_level =:debug 
  结束


将“runit”食谱放在运行列表的顶部,然后重试。

调查食谱,我发现:

配方“redis :: default”,“redis的基本configuration”
配方“redis :: install_from_package”,“从Ubuntu软件包安装 - 容易但滞后版本”
配方“redis :: install_from_release”,“从发布安装”
配方“redis ::服务器”,“具有runit服务的Redis服务器”
食谱“redis :: client”,  

当使用:redis :: install_from_package我得到了一些工作

这似乎是“runit”食谱的问题。 我有同样的问题,甚至把“runit”放在我的runlist之上。

快速解决方法是使用“redis :: install_from_package”。

PS:如果使用install_from_package得到任何exception,请尝试清理redis(因为它可能是从以前的尝试中生成的):

sudo apt-get purge redis-server rm -rf /etc/redis