I'm running chef-solo with chef-solo -c solo.rb -j node.json -ldebug and it's failing because nginx cookbook/recipe refers to user "www-data" which I don't have. Can I change the value in node.json file? My node.json looks like this:

{
  "nginx": {
    "user": "my_username"
  },
  "run_list": [
    "recipe[nginx]",
    "recipe[mysql::server]"
  ]
}

My problem is the Opscode nginx recipe appears to ignore this setting.

link|improve this question
feedback

2 Answers

up vote 0 down vote accepted

Yes :-)

www-data is just a default user that is found on debian (and debian-like systems) for running web servers. Change it to something other than root and you should be fine. For most distros where there is no www-data there is a httpd user, otherwise you can nobody.

If you are on windows then use an appropriate user.

link|improve this answer
If that doesn't work, let me know which nginx recipe you are using -- it may be hardcoded to www-data in which case you may need another recipe. The opscode nginx recipe allows the 'user' to be specified as in your question. – syserr0r Nov 29 '11 at 12:03
I was using the opscode nginx recipe, but it always threw the error about www-data user being used so I don't think this worked. I actually had "root" as the user. Eventually I wrote my own recipe which installs nginx package and uses a template to overwrite nginx.conf. – Zilupe Nov 29 '11 at 21:39
The (opscode nginx recipe)[github.com/opscode/cookbooks/blob/master/nginx/metadata.rb] shows nginx/user defined and www-data set as the default so I would assume it should be overridden with the code you posted. Strange that it isn't. Either incorrect method of defining the user or it is a bug. – syserr0r Dec 1 '11 at 12:49
feedback

The "json_attribs" file passed with the -j option to chef-{client,solo} is intended to be representative of the "default" node object similar to what would happen if you performed a knife node create FOO to create a new, blank node on a Chef Server. To override the attributes in cookbooks, you should apply them with roles.

Chef Solo can use roles. You have to specify the role_path in the configuration file.

http://wiki.opscode.com/display/chef/Chef+Solo#ChefSolo-Roles

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.