roadtest
2012-Dec-25 03:31 UTC
[Puppet Users] hiera in puppet 3.0.1 doesn''t take facter variable
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-users@googlegroups.com.
To unsubscribe from this group, send email to
puppet-users+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.
Dan White
2012-Dec-25 13:24 UTC
Re: [Puppet Users] hiera in puppet 3.0.1 doesn''t take facter variable
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-users@googlegroups.com. > To unsubscribe from this group, send email to puppet-users+unsubscribe@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 post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
roadtest
2012-Dec-25 15:48 UTC
Re: [Puppet Users] hiera in puppet 3.0.1 doesn''t take facter variable
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<javascript:>. > > > To unsubscribe from this group, send email to > puppet-users...@googlegroups.com <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/-/YPLcZhLn2YsJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
roadtest
2012-Dec-25 16:09 UTC
Re: [Puppet Users] hiera in puppet 3.0.1 doesn''t take facter variable
Further testing shows hiera can parse dynamic variable using scope file, but it can''t parse facter value. root@vm1:~# hiera --yaml /var/tmp/scope.yaml ssh_packages ["openssh-server"] root@vm1:~# more /var/tmp/scope.yaml operatingsystem: Ubuntu root@vm1:~# hiera ssh_packages nil root@vm1:~# hiera ssh_users <=ssh_users is static variable and hiera can parse it without problem. ["root", "jeff", "gary", "hunter"] 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<javascript:>. > > > To unsubscribe from this group, send email to > puppet-users...@googlegroups.com <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/-/iyI5cBxwgHsJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Dan White
2012-Dec-25 19:11 UTC
Re: [Puppet Users] hiera in puppet 3.0.1 doesn''t take facter variable
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 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/-/YPLcZhLn2YsJ.
> To post to this group, send email to puppet-users@googlegroups.com.
> To unsubscribe from this group, send email to
puppet-users+unsubscribe@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 post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to
puppet-users+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.
roadtest
2012-Dec-25 22:56 UTC
Re: [Puppet Users] hiera in puppet 3.0.1 doesn''t take facter variable
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 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/-/YPLcZhLn2YsJ.
> > To post to this group, send email to
puppet...@googlegroups.com<javascript:>.
>
> > To unsubscribe from this group, send email to
> puppet-users...@googlegroups.com <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 puppet-users@googlegroups.com.
To unsubscribe from this group, send email to
puppet-users+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.
roadtest
2012-Dec-26 03:51 UTC
Re: [Puppet Users] hiera in puppet 3.0.1 doesn''t take facter variable
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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
roadtest
2012-Dec-26 04:18 UTC
[Puppet Users] Re: hiera in puppet 3.0.1 doesn''t take facter variable
I fixed the problem by restarting puppetmaster and all dynamic facter variables are parsed properly. Thanks a lot to people who respond my question during Christmas. Now I need to explain to my wife where I am during Christmas:-) Cheers, carl On Monday, December 24, 2012 10:31:18 PM UTC-5, 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/-/jIR-Ii7ZP7IJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.