Chef local mode - role in json?

Hi Chefs,

I’m trying to run chef client in local mode. The role was not being recognized and then looking at an answer @John_Ewart provided in “chef-client -z” can not find my node, figured out that the rolename.rb had to be converted to rolename.json.


  • If I switch back to using chef server (from local mode), will the rolename.json continue to work or do i need to convert back to .rb file?

  • Is there a utility which converts .rb to a .json and vice versa?

  • Why does chef client local mode need json whereas chef server can accept a .rb, for roles?


I can’t answer all of that, but fwiw chef-server will accept roles/data_bags etc as JSON. That’s how we store them.

It definitely works as json. You can run a knife backup command against a
Chef server instance and you’ll get a local repo copy full of json files.

Thanks both; I can confirm JSON file works.