Ask Your Question
0

Pass role information to hiera.yaml

asked 2013-12-03 04:06:13 -0500

coffeejunkeysteve gravatar image

updated 2013-12-08 16:13:01 -0500

Stefan gravatar image

Hi guys,

For each Client I have a /etc/puppet/modules/hostname.yaml-file, which tells puppet which roles / classes should be applied to that client. Now I want to tell hiera to take the ".yaml"-data-sources, which are in different folders within my puppet-module. I thought I could do this by editing /etc/hiera.yaml like this:

:hierarchy: 
  - %{modulename}/manifests/%{location}/%{department}/configfile
:datadir:
  - '/etc/puppet/modules'

--> How can I automatically pass this parameters:

  • modulename
  • location
  • department

to the /etc/hiera.yaml file?

I'm really desperate and need your help.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2013-12-07 03:22:08 -0500

example42 gravatar image

updated 2013-12-08 16:11:13 -0500

Stefan gravatar image

For variables like %{location} and %{department} you can either write a custom fact that returns their value or set a top scope variable in your ENC or site.pp. For the module name you can you Puppet's internal var %{module_name}

edit flag offensive delete link more

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-12-03 04:06:13 -0500

Seen: 266 times

Last updated: Dec 08 '13