The right syntax should be following. The key(ssh_packages) should be put 
before value assignment and it returns the right value.

#hiera -c /etc/puppet/hiera.yaml ssh_packages operatingsystem=Ubuntu
["openssh-server"]

On Tuesday, December 25, 2012 10:48:25 AM UTC-5, 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 puppet...@googlegroups.com. 
>> > To unsubscribe from this group, send email to 
>> puppet-users...@googlegroups.com. 
>> > 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/-/hxV7Du7DV_EJ.
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.

Reply via email to