Ruby vs Json Roles

Do you use ruby or json roles? And why over the other?

Thanks!

JSON. Because last I checked, knife upload only supports JSON :slight_smile:

Nathan Clemons

DevOps Engineer

Moxie Cloud Services (MCS)

O +1.425.467.5075

M +1.360.861.6291

E nclemons@gomoxie.com

W www.gomoxie.comhttp://www.gomoxie.com/

Support for Ruby actually just got added to ChefFS a few days ago. Not in a release yet, but will be in 12.10 barring any huge issues :slight_smile: Another in a long line of beers I owe Thom!

We use Ruby, mostly for the fact that we can easily embed comments.

If you use ruby, how do you overcome the vagrant chef_zero issue? From what Seth Vargo said, vagrant chef_zero does not support ruby. I really like using ruby over json because it’s easy to read/edit and like you said embed comments. The big struggle we have now is our development process and vagrant. :frowning:

If it’s easier, you can write some Ruby that will generate JSON roles, but
I also use JSON since chef-zero only supports that.

Can you do a knife role show rolename -Fr to output the roles in Ruby format, too?

Nathan Clemons

DevOps Engineer

Moxie Cloud Services (MCS)

O +1.425.467.5075

M +1.360.861.6291

E nclemons@gomoxie.com

W www.gomoxie.comhttp://www.gomoxie.com/

We don’t use our roles with chef_zero. We don’t include roles with cookbooks, and we only use chef_zero for testing. We have one a few occasions tried this, and it wasn’t pretty (we were very invested into roles before Chef Zero was a thing). We did hack up some knife plugin at some point, but it stinks cause you had to remember to run it to “refresh” the json files.

I use ruby, wherever I can for roles. Its easier to read, code, test.
Testing stack is LXC+Goiardi.
best
ranjib

We use Ruby, mostly for the fact that we can easily embed comments.

For what it's worth, Chef permits comments in both databags and JSON roles. Both // single line and /* multi line */ comments are supported.

Cookbooks. Much easier to roll forward or back than roles because they are versions.

I tend to view roles as an anti-pattern in my work flow because of the above, and they are harder to keep in sync across multiple chef servers in an environment.

–Jp Robinson