On 11/26/2014 12:59 AM, Rabbie Zalaf wrote:
> Hi All,
> 
> I am building a cluster of nodes in a master-less configuration.
> 
> I wanted to ask for some assistance in setting a fact based on an
> included role, early on in the configuration so that this fact is
> available for all profiles further down the deployment track.
> 
> I have the necessary configuration to reference the fact once it's been
> set but can't figure out how to set the fact early enough.
> 
> Rabbie

Hi,

that's a classic problem. It boils down to the ability to do this at
some point in your manifest:

    if this_node_includes(class_X) {
        # do stuff only for the <x> nodes
    }

Puppet cannot compile this sort of manifest in a safe manner. It's
usually better to steer clear of such constructs.

Instead, implement some external logic that tells nodes whether they
should include class_X in the first place. This can be a flag that is
stored as a Hiera value, or a setting in your ENC.

You end up with very simple manifest constructs then.

# in site.pp perhaps
    if $should_include_class_X {
        include class_X
    }

and everywhere else, instead of asking this_node_includes(class_X), you
cann just rely on the $should_include_class_X value.

HTH,
Felix

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/5478651C.1010603%40alumni.tu-berlin.de.
For more options, visit https://groups.google.com/d/optout.

Reply via email to