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.