Hey All,

I'm trying to setup environments as well as splitting up the configs to 
correctly manage various hosts we have - but I'm running into an issue 
where a variable defined does not seem to be picked up on a puppet run.

I'm only referring to one hierarchy so I've left out a few of the other 
bits to simplify things - the setup of datadir not containing hieradata is 
due to how everything else is setup.

#cat hiera.yaml
> ---
> :backends:
>   - yaml
> :yaml:
>   :datadir: /etc/puppet
> :hierarchy:
>   - environments/%{environment}/hieradata/virtual_%{::is_virtual}
>   - 
> environments/%{environment}/hieradata/virtsh_hosting_%{is_virsh_hosting}
>   - environments/%{environment}/hieradata/common
>   - hieradata/virtual_%{::is_virtual}
>   - hieradata/virtsh_hosting_%{is_virsh_hosting}
>   - hieradata/common


I have a node definition which includes a class called "class virthost {" 
the first line of this config is

    #Used to define if its a virthost for use in hiera configs
>     $is_virsh_hosting=true


as you can see from the above, i'm using the variable so i can have a file 
called

   - virtsh_hosting_true.yaml sitting inside hieradata which works as 
   expected.

When performing the test using hiera - i get the expected results in both 
my environment & prod setup 

# hiera -d augeas_libs_version -c /etc/puppet/hiera.yaml 
> is_virsh_hosting=true
> DEBUG: Mon Aug 11 15:36:28 +0930 2014: Hiera YAML backend starting
> DEBUG: Mon Aug 11 15:36:28 +0930 2014: Looking up augeas_libs_version in 
> YAML backend
> DEBUG: Mon Aug 11 15:36:28 +0930 2014: Looking for data source 
> hieradata/virtual_
> DEBUG: Mon Aug 11 15:36:28 +0930 2014: Cannot find datafile 
> /etc/puppet/hieradata/virtual_.yaml, skipping
> DEBUG: Mon Aug 11 15:36:28 +0930 2014: Looking for data source 
> hieradata/virtsh_hosting_true
> DEBUG: Mon Aug 11 15:36:28 +0930 2014: Found augeas_libs_version in 
> hieradata/virtsh_hosting_true
> 1.0.0-5.el6_5.1



# hiera -d augeas_libs_version -c /etc/puppet/hiera.yaml 
> is_virsh_hosting=true environment=staging
> DEBUG: Mon Aug 11 15:36:39 +0930 2014: Hiera YAML backend starting
> DEBUG: Mon Aug 11 15:36:39 +0930 2014: Looking up augeas_libs_version in 
> YAML backend
> DEBUG: Mon Aug 11 15:36:39 +0930 2014: Looking for data source 
> environments/staging/hieradata/virtual_
> DEBUG: Mon Aug 11 15:36:39 +0930 2014: Cannot find datafile 
> /etc/puppet/environments/staging/hieradata/virtual_.yaml, skipping
> DEBUG: Mon Aug 11 15:36:39 +0930 2014: Looking for data source 
> environments/staging/hieradata/virtsh_hosting_true
> DEBUG: Mon Aug 11 15:36:39 +0930 2014: Found augeas_libs_version in 
> environments/staging/hieradata/virtsh_hosting_true
> 1.0.0-5.el6_5.1


If it doesn't find it in this file, it default to another version - It 
needs to be this way due to some legacy setup's on other boxes and we 
require different version of some libraries.

So, this all looks correct and its returning what I expect it to return, 
but when I run puppet on the hosts in question, it does not want to use the 
correct version - its defaulting back to a version further down the tree 
(in common.yaml)

If i move the intended config into ::is_virtual so its looking at the 
file virtual_false.yaml it works as expected - but this encompasses more 
hosts than required.

So my question is... why isn't it picking up my configuration from 
 $is_virsh_hosting=true ?

$ puppet -V
3.1.1
$ hiera -V
1.1.1

Given the puppet version.. is this bug related to my setup?
https://docs.puppetlabs.com/hiera/1/puppet.html#special-pseudo-variables

Any assistant/guidance would be appreciated.

Cheers
David






-- 
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 puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/f49e4017-b0be-44c8-9ef8-1f76e9f94eb7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to