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? >>>>>> >>>>>> >>>>>> >>>>>> -- 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/-/ENh-5ptxb98J. 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.