Ask Your Question
2

Mix Puppet Stages with Hiera_Include('classes')

asked 2013-10-01 14:20:23 -0500

louis gravatar image

Hi,

I have a list of classes that need to be executed in three different puppet stages [first, main, last]. Is it possible to keep the hiera_include('classes') function and still use the Stage declaration?. It seems that i lost this after moving all my classes to hiera yaml files.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2013-10-01 23:28:23 -0500

Ancillas gravatar image

updated 2013-10-02 18:04:15 -0500

Alright, here's my proof of concept. At a high level, here's what we're trying to achieve.

  • Wrapper classes, in this example - Role, are used to assign stages to modules.
  • Role classes are included by using hiera_include('classes')
  • Stages are defined in site.pp

site.pp

stage { 'first': }
stage { 'last': }

# the 'main' stage is added by default
# assign an order for the stages
Stage['first'] -> Stage['main'] -> Stage['last']

hiera_include('classes')

node default {}

role class (in practice, all of your roles would be sub-classes of a Role module)

class role {

  # include our classes, and assign them to stages ...
(more)
edit flag offensive delete link more

Comments

Can you provide a proof of concept example or point me to a useful link?. Thanks.

louis gravatar imagelouis ( 2013-10-02 12:36:06 -0500 )edit

In your class you can do the following and always use the default or put the stage in hiera too:

class role (
  $stage => hiera(role_stage, first),
) {
...
}

miked63017 gravatar imagemiked63017 ( 2013-10-03 04:54:26 -0500 )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

Stats

Asked: 2013-10-01 14:20:23 -0500

Seen: 1,307 times

Last updated: Oct 02 '13