# How to version to a role?

**URL:** <https://discourse.chef.io/t/how-to-version-to-a-role/2192>\
**Category:** Chef Infra (archive)\
**Created:** [November 21, 2011, 8:31am UTC](https://discourse.chef.io/t/how-to-version-to-a-role/2192 "2011-11-21T08:31:54Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bryan\_Berry](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/bryan_berry/32/213_2.png) [@Bryan\_Berry](https://discourse.chef.io/u/Bryan_Berry)\
**Post date:** [November 21, 2011, 8:31am UTC](https://discourse.chef.io/t/how-to-version-to-a-role/2192/1 "2011-11-21T08:31:54Z")

</div>

When I look at Cookbooks tab of the Chef WebUI, all my roles appear as  
version 0.0.0

Is there a way that I can set the version for my roles or are they not  
meant to have versions at all?

---

<div class="post-metadata">

**Author:** ![AJ\_Christensen](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/aj_christensen/32/525_2.png) [@AJ\_Christensen](https://discourse.chef.io/u/AJ_Christensen)\
**Post date:** [November 21, 2011, 8:36am UTC](https://discourse.chef.io/t/how-to-version-to-a-role/2192/2 "2011-11-21T08:36:06Z")

</div>

Cookbooks tab showing versions of "roles" doesn't make sense.

Look at the roles tab.

To the best of my knowledge, roles are not version-able _at all_.

--AJ

On 21 November 2011 21:31, Bryan Berry [bryan.berry@gmail.com](mailto:bryan.berry@gmail.com) wrote:

> When I look at Cookbooks tab of the Chef WebUI, all my roles appear as  
> version 0.0.0  
> Is there a way that I can set the version for my roles or are they not meant  
> to have versions at all?

---

<div class="post-metadata">

**Author:** ![Adam\_Jacob](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/adam_jacob/32/292_2.png) [@Adam\_Jacob](https://discourse.chef.io/u/Adam_Jacob)\
**Post date:** [November 21, 2011, 6:59pm UTC](https://discourse.chef.io/t/how-to-version-to-a-role/2192/3 "2011-11-21T18:59:48Z")

</div>

They are meant not to have versions.

Think about it like this. You have a tool at your disposal to describe desired state, and to encode any kind of tricky transitions around how to move from one state to the next. You can either:

A) Encode those transitions in code  
B) Encode those transitions in branches, dependencies, and version constraints

To put it more plainly, a Role should define attributes and run-lists for your infrastructure, and the run-lists may vary by environment. If you need to have custom code to make sure both an old and a new version of a component works, encode that in the recipes, rather than trying to obfuscate it with versions.

Best,  
Adam

* * *

Opscode, Inc.  
Adam Jacob, Chief Product Officer  
T: (206) 619-7151 E: [adam@opscode.com](mailto:adam@opscode.com)

On Nov 21, 2011, at 12:36 AM, AJ Christensen wrote:

> Cookbooks tab showing versions of "roles" doesn't make sense.
> 
> Look at the roles tab.
> 
> To the best of my knowledge, roles are not version-able _at all_.
> 
> --AJ
> 
> On 21 November 2011 21:31, Bryan Berry [bryan.berry@gmail.com](mailto:bryan.berry@gmail.com) wrote:
> 
> > When I look at Cookbooks tab of the Chef WebUI, all my roles appear as  
> > version 0.0.0  
> > Is there a way that I can set the version for my roles or are they not meant  
> > to have versions at all?

---

<div class="post-metadata">

**Author:** ![Bryan\_Berry](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/bryan_berry/32/213_2.png) [@Bryan\_Berry](https://discourse.chef.io/u/Bryan_Berry)\
**Post date:** [November 21, 2011, 7:08pm UTC](https://discourse.chef.io/t/how-to-version-to-a-role/2192/4 "2011-11-21T19:08:20Z")

</div>

Adam, that makes perfect sense

I was just confused by the fact that the roles appear on the cookbooks tab  
of the WebUI and that they all show the version number 0.0.0

On Mon, Nov 21, 2011 at 7:59 PM, Adam Jacob [adam@opscode.com](mailto:adam@opscode.com) wrote:

> They are meant not to have versions.
> 
> Think about it like this. You have a tool at your disposal to describe  
> desired state, and to encode any kind of tricky transitions around how to  
> move from one state to the next. You can either:
> 
> A) Encode those transitions in code  
> B) Encode those transitions in branches, dependencies, and version  
> constraints
> 
> To put it more plainly, a Role should define attributes and run-lists for  
> your infrastructure, and the run-lists may vary by environment. If you need  
> to have custom code to make sure both an old and a new version of a  
> component works, encode that in the recipes, rather than trying to  
> obfuscate it with versions.
> 
> Best,  
> Adam
> 
> * * *
> 
> Opscode, Inc.  
> Adam Jacob, Chief Product Officer  
> T: (206) 619-7151 E: [adam@opscode.com](mailto:adam@opscode.com)
> 
> On Nov 21, 2011, at 12:36 AM, AJ Christensen wrote:
> 
> > Cookbooks tab showing versions of "roles" doesn't make sense.
> > 
> > Look at the roles tab.
> > 
> > To the best of my knowledge, roles are not version-able _at all_.
> > 
> > --AJ
> > 
> > On 21 November 2011 21:31, Bryan Berry [bryan.berry@gmail.com](mailto:bryan.berry@gmail.com) wrote:
> > 
> > > When I look at Cookbooks tab of the Chef WebUI, all my roles appear as  
> > > version 0.0.0  
> > > Is there a way that I can set the version for my roles or are they not  
> > > meant  
> > > to have versions at all?

---

<div class="post-metadata">

**Author:** ![KC\_Braunschweig](https://avatars.discourse-cdn.com/v4/letter/k/ea5d25/32.png) [@KC\_Braunschweig](https://discourse.chef.io/u/KC_Braunschweig)\
**Post date:** [November 21, 2011, 11:57pm UTC](https://discourse.chef.io/t/how-to-version-to-a-role/2192/5 "2011-11-21T23:57:20Z")

</div>

On Mon, Nov 21, 2011 at 11:08 AM, Bryan Berry [bryan.berry@gmail.com](mailto:bryan.berry@gmail.com) wrote:

> Adam, that makes perfect sense  
> I was just confused by the fact that the roles appear on the cookbooks tab  
> of the WebUI and that they all show the version number 0.0.0

That should not be the case. Perhaps someone has structured your  
chef-repo in a funny way and then uploaded roles as cookbooks with no  
metadata?

KC
