0

Although no errors are thrown upon initial deploy using this run-list:

"run_list": [ "recipe[ruby_build]", "recipe[rbenv::system_install]", "recipe[main]" ]

... subsequent deploys throw multiple rsync errors like:

rsync: delete_file: unlink(ruby-build/share/ruby-build/1.9.3-p392) failed: Permission denied (13)

It seems the permissions of /tmp/chef-solo are set to root.

What's the right way to configure the rbenv and ruby-build cookbooks using knife-solo?

EDIT:

This question is really just about how to properly configure and use these two cookbooks, for example to do a user_install.

s2t2
  • 2,462
  • 5
  • 37
  • 47

3 Answers3

0

You need to run the chef-client as root.

sethvargo
  • 26,739
  • 10
  • 86
  • 156
0

You should upgrade knife-solo. The issue was fixed back in v0.3.0. You might want to read the upgrade instructions while at it.

tmatilai
  • 4,071
  • 20
  • 24
  • since there is no longer a /tmp/chef directory, which directory should be referenced in the following example? `content IO.read("/tmp/chef-solo/site-cookbooks/main/files/SOME_PATH_TO_FILE")` – s2t2 May 29 '14 at 23:28
  • 1
    The default upload is `~/chef-solo`, but you can override it with config option `knife[:provisioning_path]` or using CLI option `--provisioning-path`. Reading them directly in your cookbooks sounds like an anti-pattern. Why don't you use `cookbook_file` resource? – tmatilai May 30 '14 at 06:49
  • after revisiting the [ cookbook_file documentation](http://docs.opscode.com/resource_cookbook_file.html), i realize i had been reversing the `source` and `path` attributes. now i'm using the cookbook_file resource for this purpose. thanks! – s2t2 May 30 '14 at 17:42
0

I think I was using outdated cookbook versions. And I didn't really know how the run list worked.

To install rbenv and ruby_build via their respective cookbooks, see the following file configuration...

Cheffile:

site 'http://community.opscode.com/api/v1'
cookbook 'rbenv', :git => 'https://github.com/fnichol/chef-rbenv', :ref => 'master' 
cookbook 'ruby_build', :git => 'https://github.com/fnichol/chef-ruby_build', :ref => 'master'

make sure to librarian-chef install after updating the Cheffile

site-cookbooks/my_cookbook/recipes/default.rb:

depends 'ruby_build'
depends 'rbenv'

nodes/dna.json:

{
  "rbenv": {
    "rubies":["1.9.3-p484"],
    "global":"1.9.3-p484",
    "gems":{
      "1.9.3-p484":[
        {"name": "bundler"},
        {"name":"rails", "version": "4.0.2"},
        {"name": "rake", "version": "10.1.1"}
      ]
    }
  },
  "run_list":[
    "ruby_build", // required by "rbenv::system"
    "rbenv::system", // installs rubies and gems from dna, takes a while to finish the first time; see configuration options at https://github.com/fnichol/chef-rbenv#attributes
    "my_cookbook::default"
  ]
}

Setting these configuration variables in a recipe using node.default["var_name"] = "value_name" as suggested by the cookbook docs, did not work for me.

s2t2
  • 2,462
  • 5
  • 37
  • 47