On Monday, 18 June 2012 13:02:33 UTC+2, Peter wrote: > > Hi Puppet Users, > > I have just started playing with Puppet and Hiera. I am curious if it is > possible to control how hiera does variable lookup within a module I am > creating to test it. > > > > I have read through the documentation I can find on Hiera and Puppet > however I cannot find any documentation suggesting a way to it. > > > > For the record these are the versions that I am using (taken from the > Puppetlabs Debian/Devel): > > hiera (1.0.0-0.1rc3) > > hiera-puppet (1.0.0-0.1rc1-1-g3e68ff0) > > puppet-common (3.0.0-0.1rc3puppetlabs1) > > puppet (3.0.0-0.1rc3puppetlabs1) > > > > Essentially I would like to define a hiera.yaml file (just the hierarchy > and puppet datasource location) within my module and use it to clearly > separate Operating System differences to the default state. For example: > > > The hiera.yaml file is the global configuration for all paths, however it could contain a
path of /etc/puppet/modules/%{module_name}/config/operatingsystem /etc/puppet/modules/%{module_name}/config/defaults > ------==== {modulepath}/hiera.yaml =======------ > > :hierarchy: > > - %{operatingsystem} > > - defaults > > > > :puppet: > > :datasource: %{modulename}/config/ > > ------===========------ > > > > So in my module directory I could have: > > {modulepath}/config/debian.pp > > {modulepath}/config/centos.pp > > {modulepath}/config/defaults.pp > > > > (It would be even better if in the file name somehow we could grip up > similar OS types, ie debian_ubuntu.pp) > > > Look at the "osfamily" fact, this debian on ubuntu and redhat. > I know that I can use puppet logic statements (case statements, if, …) to > set variables per OS but I feel that it would be cleaner and clearer to > separate the OS specific stuff and it would be easier to update a module > for a specific OS and override something set in the defaults.pp file. > > > > So is this possible or is this something that could be considered as a > feature request. > > So it's possible but you can't distribute the hiera.yaml with your module since this is a site setting. > > > Thanks, > > > > Peter. > -- 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/-/dlrUWu1b8OsJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.