Hi,
I got the same errors after change from %{operatingsystem} to
%{::operatingsystem}.
In the mean time, I did similar testing using puppet enterprise(default
puppet is 2.7.x), which is running hiera 0.3.0 , without any problem. It
nicely parse operatingsystem to Ubuntu and worked like a charm. Does this
mean I can't use dynamic variable with hiera 1.1.1 in puppet 3.0.1?
Btw, the return of "facter -p operatingsystem" is Ubuntu and I am aware it
is case sensitive.
Thanks,
carl
On Tuesday, December 25, 2012 2:11:49 PM UTC-5, Ygor wrote:
>
> OK. Consider:
>
> ------
> http://docs.puppetlabs.com/facter/1.6/core_facts.html#summary
> Facts appear in Puppet as normal top-scope variables
> ------
>
> ------
> http://docs.puppetlabs.com/hiera/1/configuring.html#format
> Each top-level key in the hash must be a Ruby symbol with a colon (:)
> prefix. The available settings are listed below, under “Global Settings”
> and “Backend-Specific Settings”.
>
> Example Config File
>
> ---
> :backends:
> - yaml
> - json
> :yaml:
> :datadir: /etc/puppet/hieradata
> :json:
> :datadir: /etc/puppet/hieradata
> :hierarchy:
> - %{::clientcert}
> - %{::custom_location}
> - common
> ------
>
> Based on those two factoids, I would suggest trying the following in your
> hiera.yaml:
>
> :hierarchy:
>
> - %{::operatingsystem}
> - common
>
>
> All the examples here http://docs.puppetlabs.com/hiera/1/hierarchy.html have
> the double-colon notation
>
> Also, just to be thorough, what does "facter -p operatingsystem" return ?
>
> On Dec 25, 2012, at 10:48 AM, roadtest wrote:
>
> > Thanks for your reply! Here is the output.
> >
> > root@vm1:/etc/puppet/modules/ssh/manifests# hiera -c
> /etc/puppet/hiera.yaml ssh_packages
> > nil
> > root@vm1:/etc/puppet/modules/ssh/manifests# hiera -c
> /etc/puppet/hiera.yaml operatingsystem=Ubuntu ssh_packages
> > ssh_packages
> >
> >
> > It appears ssh_packages is not resolved properly.
> >
> > Thanks,
> >
> > carl
> >
> > On Tuesday, December 25, 2012 8:24:29 AM UTC-5, Ygor wrote:
> > What do the following commands return ?
> >
> > hiera -c /etc/puppet/hiera.yaml ssh-packages
> >
> > hiera -c /etc/puppet/hiera.yaml operatingsystem=Ubuntu ssh-packages
> >
> > On Dec 24, 2012, at 10:31 PM, roadtest wrote:
> >
> > > Hello,
> > >
> > > I follow
> http://puppetlabs.com/blog/first-look-installing-and-using-hiera/ to try
> hiera on my 3.0.1 puppet master. I follow the instruction except my
> environment is ubuntu. Here is my /etc/hiera.yaml
> > > ---
> > > :hierarchy:
> > > - %{operatingsystem}
> > > - common
> > > :backends:
> > > - yaml
> > >
> > > :yaml:
> > > :datadir: '/var/lib/hiera'
> > >
> > > Here is my backends
> > > $more /var/lib/hiera/Ubuntu.yaml
> > > ---
> > > ssh_packages : - 'openssh-server'
> > >
> > > Here is section of ssh class
> > > $more /etc/puppet/modules/ssh/manifests/init.pp
> > > class ssh {
> > > # $ssh_packages =
> ['openssh','openssh-clients','openssh-server']
> > > # $ssh_packages = ['openssh-server']
> > > # $permit_root_login = 'no'
> > > #$ssh_users = ['root','jeff','gary','hunter']
> > > $ssh_packages = hiera('ssh_packages')
> > > $permit_root_login = hiera('permit_root_login')
> > > $ssh_users = hiera('ssh_users')
> > >
> > > package { $ssh_packages:
> > > ensure => present,
> > > before => File['/etc/ssh/sshd_config'],
> > > }
> > > file { '/etc/ssh/sshd_config':
> > > ensure => present,
> > > owner => 'root',
> > > group => 'root',
> > > mode => '0644',
> > > # Template uses $permit_root_login and $ssh_users
> > > content => template('ssh/sshd_config.erb'),
> > > }
> > >
> > > service { 'sshd':
> > > ensure => running,
> > > enable => true,
> > > hasstatus => true,
> > > hasrestart => true,
> > > }
> > > }
> > >
> > > when my ubuntu client is trying to pull the catalog, it has following
> errors.
> > > Dec 24 22:17:07 vm2 puppet-agent[18103]: Could not retrieve catalog
> from remote server: Error 400 on SERVER: Could not find data item
> ssh_packages in any Hiera data file and no default supplied at
> /etc/puppet/modules/ssh/manifests/init.pp:6 on node vm2
> > >
> > > It appears to me that %{operatingsystem} in hiera.yaml is invalid and
> ssh_packages can't be properly assigned even it is valid on the client
> machine.
> > > vm2# facter | grep operatingsystem
> > > operatingsystem => Ubuntu
> > > operatingsystemrelease => 12.04
> > >
> > > I can't figure out what wrong with my configuration. Thanks for any
> suggestions!
> > >
> > > carl
> > >
> > >
> > >
> > > --
> > > 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/-/Hm7YfNU7MT0J.
> > > To post to this group, send email to [email protected].
> > > To unsubscribe from this group, send email to
> [email protected].
> > > For more options, visit this group at
> http://groups.google.com/group/puppet-users?hl=en.
> >
> >
> > --
> > 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/-/YPLcZhLn2YsJ.
> > To post to this group, send email to
> > [email protected]<javascript:>.
>
> > To unsubscribe from this group, send email to
> [email protected] <javascript:>.
> > For more options, visit this group at
> http://groups.google.com/group/puppet-users?hl=en.
>
>
--
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/-/BvAh-bDZL-EJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.