Ask Your Question

Migrating to roles/profiles

asked 2013-12-16 22:17:43 -0600

josh gravatar image

updated 2013-12-17 09:44:04 -0600

I'm looking to re-factor our moduleset using the roles/profile method defined by Craig Dunn [1]. I'm having a difficult time wrapping my head around how to convert my current "base" module to profiles. Currently, my base module looks like:

class base(
  $something = "blah"
) {
  class {'base::network': } ->
  class {'base::resolv': } ->
  class {'base::facts': } ->

It's fairly self-explanatory as to what this module does. So, I first associate a node with a role:

node testnode {
  include role::webserver

Next, I define the role and include the base profile which every node should get. I'm opting not ... (more)

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2013-12-19 11:34:14 -0600

ramindk gravatar image

updated 2013-12-19 11:42:00 -0600

EDIT: if you haven't looked through Craigs slides for his most recent talk he explains a bit more how to organize role/profile.

The base:: classes are a bit of an antipattern in my opinion. Moving them out to normal modules and then wrapping them in a profile class would be the way I'd approach it.

class profile::base {
  class {'network': } ->
  class {'resolv': } ->
  class {'facts': }

fwiw, I do it this way without an ENC and use Hiera for everything. I'm not sure inheritance at the node level causes the same problems ... (more)

edit flag offensive delete link more


Thanks for the answer. At the moment, I'm just calling ::base from profiles::base, and ::base takes care of it's submodules. I agree though, and I may end ...(more)

josh gravatar imagejosh ( 2013-12-19 14:46:58 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2013-12-16 22:17:43 -0600

Seen: 712 times

Last updated: Dec 19 '13