Ask Your Question

Mix Puppet Stages with Hiera_Include('classes')

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

louis gravatar image


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

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

Ancillas gravatar image

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

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


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

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


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 ...
edit flag offensive delete link more


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 -0600 )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 -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-10-01 14:20:23 -0600

Seen: 1,473 times

Last updated: Oct 02 '13