0

I have a bunch of cookbook files, some defined as recipes and some defined as roles. So for example the top level role is:

run_list( "role[el-drupal-cookbook::drupal_lamp_dev]" , "recipe[drupal-site-jnl-el-cookbook::default]" )

The intent of the above is to set up the server as a drupal lamp server and then install a specific website on it.

I'm calling it all from Vagrant, using an add_role request, and librarian-chef pulling all the bits together. The cookbook path is "cookbooks", and the role_path is "roles".

When this is executed, it finds the top level role (which is in the same directory as the Vagrantfile) but not those that are in different cookbooks.

As roles and recipes are both stored in cookbooks that the cookbook path should serve, so I'm obviously missing something. Can anyone help?

I've attached the error message below:

[2013-10-24T14:37:28+00:00] INFO: Setting the run_list to ["recipe[apt]", "recipe[git]", "role[drupal-jnl-el]", "recipe[drupal-site-jnl-el-cookbook::disable-cdn]"] from JSON
[2013-10-24T14:37:28+00:00] ERROR: Role el-drupal-cookbook::drupal_lamp_dev (included by 'role[drupal-jnl-el]') is in the runlist but does not exist. Skipping expand.

================================================================================
Error expanding the run_list:
================================================================================


Missing Role(s) in Run List:
----------------------------
* el-drupal-cookbook::drupal_lamp_dev included by 'role[drupal-jnl-el]'


Original Run List
-----------------
* recipe[apt]
* recipe[git]
* role[drupal-jnl-el]
* recipe[drupal-site-jnl-el-cookbook::disable-cdn]

EDIT:

The vagrantfile says:

# define where things have been collected together by librarian-chef
chef.cookbooks_path = ["cookbooks"]
chef.roles_path = ["roles"]

# this installs most of the infrastrucutre required to support a drupal instance
chef.add_recipe "apt" # add this so we have updated packages available
chef.add_recipe "git"
# chef.add_recipe "openvpn"  # vpn needed, but using tunnelblick on mac host instead.

# This role represents our default Drupal development stack.
chef.add_role   "drupal-jnl-el"
rivimey
  • 921
  • 1
  • 7
  • 24
  • Could you please share that part of your Vagrantfile? I'm wondering, why you say that your roles are in the cookbooks. For roles there should be a *.rb file in roles/ each. For cookbook, you have subdirectories below cookbooks/. – StephenKing Oct 24 '13 at 15:59
  • The vagrantfile fragment attached. In the source (that lib-chef collects) there are roles and recipes directories beside each other, with appropriate files in each. L-C collects these into the cookbooks folder... – rivimey Oct 25 '13 at 08:57

2 Answers2

1

It says

Missing Role(s) in Run List:
----------------------------
* el-drupal-cookbook::drupal_lamp_dev included by 'role[drupal-jnl-el]'

This means that roles/drupal.{rb,json} tries to include a role[el-drupal-cookbook::drupal_lamp_dev], which should be a recipe[el-drupal-cookbook::drupal_lamp_dev] however.

StephenKing
  • 36,187
  • 11
  • 83
  • 112
  • I hope that's finally the problem :-) – StephenKing Oct 25 '13 at 15:31
  • I think I'd mostly got there: essentially, don't use roles for anything generic because you can't nest them across cookbooks, unlike recipes. I was getting confused because in the cookbooks I inherited I have ../{attributes,recipes,roles,templates,...} which made me think otherwise. – rivimey Oct 25 '13 at 16:01
  • Don't get you. Roles can be nested. E.g. run_list("role[some_other_role]"). – StephenKing Oct 26 '13 at 13:34
  • What I meant is that, unlike recipes, roles exist in one namespace and one directory. There is no search path for roles, as far as I can tell. – rivimey Oct 26 '13 at 22:34
0

You need to add that role to your knife role list, try

knife role from file your_role_name.js

By default the command will look for that role in roles/ directory (in your project root)

Ryan
  • 156
  • 2
  • 18
  • Hi ryan, thanks for the thought but I'm using chef-solo, not server... is there an equivalent for that? – rivimey Oct 25 '13 at 08:56
  • hmm.. just to double check, have you set role_path in solo.rb? – Ryan Oct 25 '13 at 09:09
  • I am not sure... I haven't done anything in solo.rb but of course Vagrant might have?? How would I check? – rivimey Oct 25 '13 at 10:43
  • role_path in solo.rb is derived from the vagrantfile definition listed above: chef.roles_path but translated to work from the VM side. The VM view is /tmp/vagrant-chef-1/chef-solo-1/cookbooks and vagrant-chef-1/chef-solo-1/roles, while the host view is ./cookbooks and ./roles where . is the directory containing the Vagrantfile and Cheffile. – rivimey Oct 25 '13 at 13:07