I am also having the same issue you were having.  When I removed the 
'%{environment}' part of the datadir, hiera works fine, however for me to 
have different development stages, I need to be able to specify 
environments so I don't accidentally take down production with a change to 
hiera variable.  Did anyone find a way for this to work?


:yaml:
    :datadir: '/etc/puppet/environments/%{environment}/hieradata/'

On Wednesday, July 11, 2012 2:18:18 PM UTC-4, Luke Baker wrote:
>
> Ok, I was able to get this to work by removing my environments.
>
> /etc/puppet/hieradata/
> ├── common.yaml
>
> /etc/puppet/hiera.yaml
> ---
> :hierarchy: 
>     - common
> :backends:
>     - yaml
> :yaml:
>     :datadir: /etc/puppet/hieradata
>
> On Wednesday, July 11, 2012 10:42:20 AM UTC-5, Andreas Paul wrote:
>>
>> Hiera would look in your RedHat.yaml first, if you would tell hiera, that 
>> this lookup variable is available, by using
>> hiera -d -c /etc/puppet/hiera.yaml sshpackages environment=development 
>> operatingsystem=RedHat
>>
>> Which would always get passed to hiera by puppet, along with all facter 
>> variables.
>>
>> I still can't seem to find anything wrong with your configuration though 
>> :(
>> It's really bewildering that it's working with the CLI and not within 
>> puppet.
>>
>> Did you try adding 
>>
>> :puppet:
>>     :datasource: data
>> to your hiera.yaml?
>>
>> Do you have multiple hiera.yaml files by any chance?
>>
>> On Wednesday, July 11, 2012 3:02:34 PM UTC+2, Luke Baker wrote:
>>>
>>> I've defined the sshpackages in common.yaml and RedHat.yaml - they're 
>>> slightly different (I was using the different packages to test lookups).
>>>
>>> [root@puppet-dev ~]# cat 
>>> /etc/puppet/environments/development/hieradata/common.yaml 
>>> ---
>>> sshpackages: - 'openssh'
>>>              - 'openssh-clients'
>>> permit_root_login : 'no'
>>>
>>> [root@puppet-dev ~]# cat 
>>> /etc/puppet/environments/development/hieradata/RedHat.yaml 
>>> ---
>>> ssh_packages: - 'openssh'
>>>               - 'openssh-clients'
>>>               - 'openssh-server'
>>>
>>>
>>> Output from hiera debug:
>>> [root@puppet-dev ~]# hiera -d -c /etc/puppet/hiera.yaml sshpackages 
>>> environment=development
>>> DEBUG: Wed Jul 11 07:52:41 -0500 2012: Hiera YAML backend starting
>>> DEBUG: Wed Jul 11 07:52:41 -0500 2012: Looking up sshpackages in YAML 
>>> backend
>>> DEBUG: Wed Jul 11 07:52:42 -0500 2012: Looking for data source common
>>> ["openssh", "openssh-clients"]
>>>
>>> I would think that hiera would look up 'RedHat.yaml' first, since 
>>> 'operatingsystem' is listed first in the hierarchy. 
>>>
>>> The hiera gems are installed:
>>> [root@puppet-dev specifications]# gem list hiera
>>>
>>> *** LOCAL GEMS ***
>>>
>>> hiera (0.3.0)
>>> hiera-puppet (0.3.0)
>>>
>>>
>>> On Wednesday, July 11, 2012 6:01:40 AM UTC-5, Andreas Paul wrote:
>>>>
>>>> That's odd.
>>>>
>>>> Where do you define your sshpackages?
>>>> Can you show the hiera debug output with
>>>>
>>>> hiera -d -c /etc/puppet/hiera.yaml sshpackages environment=development
>>>>
>>>> My hiera.yaml config file also contains
>>>>
>>>> :puppet:
>>>>     :datasource: data
>>>>
>>>> But I don't really know what this is for and puppet can still access 
>>>> hiera variables, if I remove this.
>>>>
>>>> You do have the hiera-puppet gem installed, right?
>>>>
>>>> gem list hiera
>>>>
>>>> *** LOCAL GEMS ***
>>>>
>>>> hiera (0.3.0)
>>>> hiera-puppet (0.3.0)
>>>>
>>>> I guess you have, otherwise you would get an unknown function error in 
>>>> your puppetrun.
>>>>
>>>>
>>>> On Tuesday, July 10, 2012 4:46:29 PM UTC+2, Luke Baker wrote:
>>>>>
>>>>> Hmm, I moved the config file to /etc/puppet/ but my client is still 
>>>>> giving me grief.
>>>>>
>>>>> On Tuesday, July 10, 2012 9:15:49 AM UTC-5, Andreas Paul wrote:
>>>>>>
>>>>>> AFAIK hiera-puppet looks for 
>>>>>> */etc/puppet/hiera.yaml*
>>>>>> whereas the hiera CLI looks for
>>>>>> */etc/hiera.yaml*
>>>>>>
>>>>>> You can still use the CLI by specifying the config file
>>>>>> hiera -c /etc/puppet/hiera.yaml sshpackages environment=development
>>>>>> or just symlink it :)
>>>>>>
>>>>>> On Tuesday, July 10, 2012 3:31:43 PM UTC+2, Luke Baker wrote:
>>>>>>>
>>>>>>> Hey there, 
>>>>>>>
>>>>>>> I'm new to hiera and I' m looking to configure it to use multiple 
>>>>>>> environments. I'm able to query hiera keys from using the hiera CLI, 
>>>>>>> however my clients seem to be having problems identifying the look up 
>>>>>>> variables.
>>>>>>>
>>>>>>> *On the puppet master, CLI query*
>>>>>>> [root@puppet-dev puppet]# hiera -a sshpackages 
>>>>>>> environment=development
>>>>>>> ["openssh", "openssh-clients"]
>>>>>>> *
>>>>>>>
>>>>>>> Puppet master, testing gem load*
>>>>>>> [root@puppet-dev puppet]# irb
>>>>>>> irb(main):001:0> require 'rubygems'
>>>>>>> => true
>>>>>>> irb(main):002:0> require 'hiera'
>>>>>>> Invalid gemspec in 
>>>>>>> [/usr/lib/ruby/gems/1.8/specifications/tilt-1.3.3.gemspec]: invalid 
>>>>>>> date 
>>>>>>> format in specification: "2011-08-25 00:00:00.000000000Z"
>>>>>>> => true
>>>>>>>
>>>>>>>
>>>>>>> *Directory structure*
>>>>>>> [root@puppet-dev puppet]# tree /etc/puppet/environments/ -d -L 2
>>>>>>> /etc/puppet/environments/
>>>>>>> ├── development
>>>>>>> │   ├── hieradata
>>>>>>> │   └── modules
>>>>>>> └── production
>>>>>>>     ├── hieradata
>>>>>>>     └── modules
>>>>>>>
>>>>>>>
>>>>>>> *Configuration file*
>>>>>>> [root@puppet-dev puppet]# cat /etc/hiera.yaml 
>>>>>>> ---
>>>>>>> :hierarchy:
>>>>>>>     - %{environment}
>>>>>>>     - %{operatingsystem}
>>>>>>>     - common
>>>>>>> :backends:
>>>>>>>     - yaml
>>>>>>> :yaml:
>>>>>>>     :datadir: '/etc/puppet/environments/%{environment}/hieradata/'
>>>>>>>
>>>>>>>
>>>>>>> *Test manifest*
>>>>>>> class hiera_test {
>>>>>>>
>>>>>>>     $packages = hiera('sshpackages')
>>>>>>>     notify { $packages: }
>>>>>>> }
>>>>>>>
>>>>>>>
>>>>>>> However, my test client errors out with the following message:
>>>>>>> err: Could not retrieve catalog from remote server: Error 400 on 
>>>>>>> SERVER: Could not find data item sshpackages in any Hiera data file and 
>>>>>>> no 
>>>>>>> default supplied at 
>>>>>>> /etc/puppet/environments/development/modules/hiera_test/manifests/init.pp:16
>>>>>>>  
>>>>>>> on node bakerlu-sb.missouri.edu
>>>>>>>
>>>>>>> Anyone have words of wisdom or see anything wrong with my 
>>>>>>> configuration?
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
-- 
_____________________________________________________
This email and any files transmitted with it are confidential and intended 
solely for the addressee.  If you received this email in error, please do 
not disclose the contents to anyone; kindly notify the sender by return 
email and delete this email and any attachments from your system.

© 2011 Currensee Inc. is a member of the National Futures Association (NFA) 
Member ID 0403251 | Over the counter retail foreign currency (Forex) 
trading may involve significant risk of loss. It is not suitable for all 
investors and you should make sure you understand the risks involved before 
trading and seek independent advice if necessary. Performance, strategies 
and charts shown are not necessarily predictive of any particular result 
and past performance is no indication of future results. Investor returns 
may vary from Trade Leader returns based on slippage, fees, broker spreads, 
volatility or other market conditions.

Currensee Inc | 54 Canal St 4th Floor | Boston, MA 02114 | +1.617.624.3824

-- 
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 post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to