Ask Your Question
1

hiera : how to specify classes to be applied to a node

asked 2013-06-24 20:18:42 -0500

BaltoStar gravatar image

updated 2013-06-26 17:30:15 -0500

I'm starting to understand how hiera *.yaml hierarchies are read to determine a full set values to pass to a class' parameter-set ... but that's just the class parameters ....

How to specify the full set of classes to be applied to a node ?

edit retag flag offensive close merge delete

Comments

I have updated my answer with the correct syntax. You can also write a default.yaml file that includes classes that all nodes should include, then use hostname-specific YAML files ...(more)

GregLarkin gravatar imageGregLarkin ( 2013-06-25 13:46:31 -0500 )edit

Thanks Greg. Is default.yaml automatically included for all nodes ? Or in hiera.yaml do I need to include "-default" in my ":hierarchy:" section ?

BaltoStar gravatar imageBaltoStar ( 2013-06-26 17:34:37 -0500 )edit

You do need to include "- default" in your :hierarchy: section and then create a default.yaml in your hiera data directory. Everything defined in that file will be included in ...(more)

GregLarkin gravatar imageGregLarkin ( 2013-06-27 18:38:10 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2013-06-25 11:40:42 -0500

GregLarkin gravatar image

updated 2013-06-25 14:20:35 -0500

I use an ENC (Puppet Dashboard, in this example) to specify the classes to be applied to a node. When given a node name, the ENC returns some YAML like this:

--- 
name: db-master.mydomain.tld
parameters: 
  type: master
classes: 
- roles::prod::db::init

The class roles::prod::db::init drives all of the class hierarchy to be applied to this node. In this case, the type parameter will configure the node as a master database server.

At the same time, there exists a /var/lib/hiera/db-master.mydomain.tld.yaml file containing a list that specifies the databases to ensure ... (more)

edit flag offensive delete link more

Comments

Thanks Greg, but ENC might be too advanced for me right now. Instead, I'd like to use a nodes manifest ( *.pp ). In the node def , how do I specify ...(more)

BaltoStar gravatar imageBaltoStar ( 2013-06-25 12:37:37 -0500 )edit

Ok, so I can specify a node's included classes in either the nodes def file ( *.pp ) or in the specific node's hiera file ( *.yaml ). For hiera-based configs, I ...(more)

BaltoStar gravatar imageBaltoStar ( 2013-06-25 13:57:31 -0500 )edit

Yes, I edited the YAML file just above to show how you can specify the classes for a node as well as other parameters that are referenced within your .pp ...(more)

GregLarkin gravatar imageGregLarkin ( 2013-06-25 14:04:01 -0500 )edit

Oops, misread your question. Our project started with all class declarations in nodes.pp. Eventually, we needed to generate some class params on the fly (usernames, etc.) and those went ...(more)

GregLarkin gravatar imageGregLarkin ( 2013-06-25 14:18:55 -0500 )edit

Using the Hiera YAML files for declaring classes as well as other parameters looks like a good way to go. In that case, I recommend storing them in revision control.

GregLarkin gravatar imageGregLarkin ( 2013-06-25 14:19:37 -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-24 20:18:42 -0500

Seen: 1,174 times

Last updated: Jun 26 '13