FAQ
Hi People,

Let's imagine a scenario where I have multiple nodes, a very simple
hierarchy:

- nodes/%{fqdn}
- roles/%{role}
- common

So what I am trying to achieve is for instance a class 'foo' is always
included in 'common.yaml' and all the nodes will have that class included
by default, but I want a specific node to have that class excluded or
disabled. How do I do that?

I use hiera to include classes, for example my common.yaml looks like:

---
classes:
- foo


I was told on #puppet IRC channel that there is a metaparameter called
'noop' which can be passed to already created class, but what hiera does is
just a simple alternative to 'include foo', so I cannot really pass any
metaparameters to my classes when including them with hiera.

What other alternatives do I have?

Thanks,
Vaidas

--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/7llgTGOOpmgJ.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.

Search Discussions

  • Jcbollinger at Oct 24, 2012 at 8:28 pm

    On Wednesday, October 24, 2012 11:19:43 AM UTC-5, Vaidas Jablonskis wrote:
    Hi People,

    Let's imagine a scenario where I have multiple nodes, a very simple
    hierarchy:

    - nodes/%{fqdn}
    - roles/%{role}
    - common

    So what I am trying to achieve is for instance a class 'foo' is always
    included in 'common.yaml' and all the nodes will have that class included
    by default, but I want a specific node to have that class excluded or
    disabled. How do I do that?

    I use hiera to include classes, for example my common.yaml looks like:

    ---
    classes:
    - foo


    I was told on #puppet IRC channel that there is a metaparameter called
    'noop' which can be passed to already created class, but what hiera does is
    just a simple alternative to 'include foo', so I cannot really pass any
    metaparameters to my classes when including them with hiera.

    What other alternatives do I have?
    There are three main alternatives:

    1. The old-school way would be to create a subclass of the class you
    want to disable, and in it override properties of the base class's
    resources appropriately to (more or less) cancel the main class. Include
    the subclass on the nodes that need it.
    2. You could also lift the troublesome class out of the "common" level
    of your data hierarchy (which would make sense because it's not really
    common). You could move it to the role or even the node level, perhaps
    splitting your roles into role_with_special_class and
    role_without_special_class if it does not automatically fall out that way.
    Or you could create a new hierarchy level between "common" and "role/*"
    where you would draw the distinction. Or you could take it all the way out
    of hiera and use node blocks or top-level conditional statements in site.pp
    to direct which nodes get the class.
    3. Or you could modify your class to have some kind of override
    variable, read separately from hiera or computed by the class. By setting
    some special value of that datum in per-node data, you could trigger a
    conditional statement in your class body that skips all the other
    declarations in the class.


    John

    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/DqJCJmbTOwIJ.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppuppet-users @
categoriespuppet
postedOct 24, '12 at 4:19p
activeOct 24, '12 at 8:28p
posts2
users2
websitepuppetlabs.com

2 users in discussion

Vaidas Jablonskis: 1 post Jcbollinger: 1 post

People

Translate

site design / logo © 2022 Grokbase