Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

2 Answers 2

up vote 1 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.

share|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

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

share|improve this answer
    
I think your link is now docs.getchef.com/chef_solo.html#roles. Is there any documentation elaborating on what can and cannot be done in a node json file because docs.getchef.com/knife_node.html doesn't seem to cover attributes... –  KCD Jul 31 at 9:50

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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