I just upgraded to puppet 3.8. Things I used to do in 3.7 like import and 
inherits no longer work. Anyway, I have been trying to figure out hiera. 
The docs on the site are great if you already know what you are doing. 
Anyway, I have environments setup. And have the hiera.yaml setup and 
working. Here is the hiera.yaml.

---
:backends:
  - yaml
:yaml:
  :datadir: "/etc/puppet/environments/%{::environment}/hieradata"
:hierarchy:
  - "nodes/%{::trusted.certname}"
  - "%{::osfamily}/%{::operatingsystemmajrelease}"
  - "virtual/%{::virtual}"
  - "common"


under my development einvironment I have 

RedHat/6.yaml
RedHat/7.yaml

6.yaml has info for ntp and 7.yaml has info for chrony.

6.yaml
---
ntp::restrict: 127.0.0.1
ntp::service_enable: true
ntp::service_ensure: running
ntp::servers:
  - ntp.server.com

7.yaml
---
chrony::service_enable: true
chrony::service_ensure: running
chrony::servers:
  - ntp.server.com

That all looks fine and hiera test works.
$ hiera ntp::service_enable ::environment=development ::osfamily=RedHat 
::operatingsystemmajrelease=6
true

Now I am unsre how to make use of this in  my site.pp.

I have this, but it is not working:

if $operatingsystemmajrelease =~ '6' {
   include ntp
}
elsif $operatingsystemmajrelease == '7' {
   include chrony
}

It's setting the ntp.conf and chrony.conf files to the defaults. I really 
like puppet when it is working. But trying to figure this out is just 
pissing me off. I wish there was a doc that would hold my hand and just 
give exact examples on how to get this to work. It's not intuitive.






-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/62c54869-4f91-449f-bf31-3f720db862ab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to