Ask Your Question
2

How to exclude data from yaml file ?

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

Przemek gravatar image

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

We have the following configuration

hiera.yaml:
...
:hierarchy:
  - nodes/%{fqdn}
  - virtual/%{virtual}
  - os/%{operatingsystem}/%{operatingsystemmajrelease}
  - common
...

And the following common.yaml file:

...
classes:
  - 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:

...
classes:
  - 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
0

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

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

Comments

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 -0500 )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 -0500 )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 -0500 )edit

Ah, we posted at the same time :).

Ancillas gravatar imageAncillas ( 2013-06-18 11:34:54 -0500 )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 -0500 )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

Stats

Asked: 2013-06-18 10:43:02 -0500

Seen: 604 times

Last updated: Jun 18 '13