Ask Your Question

How to exclude data from yaml file ?

asked 2013-06-18 10:43:02 -0600

Przemek gravatar image

updated 2013-06-18 11:23:57 -0600

We have the following configuration

  - nodes/%{fqdn}
  - virtual/%{virtual}
  - os/%{operatingsystem}/%{operatingsystemmajrelease}
  - common

And the following common.yaml file:

  - class1
  - class2
  - class3
  - class4

Then in site.pp :

node default {
        hiera_include ( "classes", [] )

Basically it it very convenient. The problem is when I want to exclude one or two classes from one server which is a bit different then the others,e.g:

  - class1
  - class2

How would you do that ? Is there any syntax in hiera saying not to include particular data from hiera file ?

EDIT: I have changed one line from hiera.yaml file:

 - nodes/%{fqdn}
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2013-06-18 11:15:03 -0600

Ancillas gravatar image

You would add %{hostname} to the top of your hierarchy, and then provide overrides in %{hostname}.yaml files.

edit flag offensive delete link more


Ancillas, please read my edited post. I have changed in the meantime the hiera.yaml file to follow your ideas but it doesn't work. I have one class in ...(more)

Przemek gravatar imagePrzemek ( 2013-06-18 11:28:54 -0600 )edit

The CLI: hiera classes fqdn=<name> environment=env1 doesn't show this class. But while running on the node "puppet agent --test --server ..." it is still deployed.

Przemek gravatar imagePrzemek ( 2013-06-18 11:32:21 -0600 )edit

If you call hiera on the command line, do you get the array of classes from <fqdn>.yaml or from common.yaml? `hiera classes fqdn=<fqdn>`

Ancillas gravatar imageAncillas ( 2013-06-18 11:34:34 -0600 )edit

Ah, we posted at the same time :).

Ancillas gravatar imageAncillas ( 2013-06-18 11:34:54 -0600 )edit

The documentation of hiera_include() doesn't indicate it merges like hiera_array() and hiera_hash(), but maybe it does?

Ancillas gravatar imageAncillas ( 2013-06-18 11:36:02 -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-06-18 10:43:02 -0600

Seen: 837 times

Last updated: Jun 18 '13