I’m very new to Puppet and learn something new about it every day. The most handy thing I’ve learned lately is how to use stages.
class shibboleth-idp-build {
stage { "pre": before => Stage["main"]}
stage { "prep": require => Stage["pre"]}
stage { "deploy": require => Stage["prep"]}
stage { "install": require => Stage["deploy"]}
stage { "configure": require => Stage["install"]}
}
In this example I define five stages that I use to separate chunks of puppet code which describe how to build a Shibboleth Identity Provider. By themselves, these mean nothing.
To use them, I create five classes and place all of my resources in them. When it’s time to assign a node to the Shibboleth IDP classes, I specify the class/stage relationships in my node file like this:
node "example.machine.com" {
include shibboleth-idp-build
# place classes in their stages
class { "shibboleth-idp-pre": stage => pre }
class { "shibboleth-idp-prep": stage => prep }
class { "shibboleth-idp-deploy": stage => deploy }
class { "shibboleth-idp-install": stage => install }
class { "shibboleth-idp-configure": stage => configure }
}
To define the node, I include the build class which defines my stages, and explain which class belongs to which stage. When puppet builds the machine, it will run the catalog for each class in order of the stages I’ve outlined in the shibboleth-idp-build class.
Leave a comment