Gavin Williams
2012-Dec-21 11:32 UTC
[Puppet Users] Hiera and ''clientcert'' fact not working :(
Morning All
I''m trying to use Hiera with Puppet 3.0 to streamline some of my module
configuration...
However I''m having issues using the
''*%{::clientcert}*'' variable as part of
the hierarchy...
Currently, my *hiera.yaml* file looks like:
---
:backends:
- yaml
- json
:yaml:
:datadir: /etc/puppet/hieradata
:json:
:datadir: /etc/puppet/hieradata
:hierarchy:
- nodes/%{::clientcert}
- common/%{::location}
- common/%{::environment}
- common/common
*/etc/puppet/hieradata* contains:
-bash-4.1$ ls -R /etc/puppet/hieradata/
/etc/puppet/hieradata/:
common nodes
/etc/puppet/hieradata/common:
common.yaml star-int.yaml test.yaml
/etc/puppet/hieradata/nodes:
puppet-test.card.co.uk.yaml
Currently I''m just testing with a notify in the *manifests/site.pp*
file:
node ''puppet-test.card.co.uk'' {
$filer_name = hiera(''filer_name'')
notify{''puppet-test_notify'':
message => "Puppet-test.card.co.uk filername =
${filer_name}"
}
}
The hiera values this node *should* be pulling back is:
$ hiera -c hiera.yaml filer_name clientcert=puppet-test.card.co.uk
puppet-test filer
I am using an ENC with this puppet install, however that all appears to be
working fine aswell...
Node ENC details are:
$ ./node.rb puppet-test.card.co.uk
---
environment: &id001 test
classes:
- act::products::cms
parameters:
root_pw: xybxa6JUkz63w
location: star-int
foreman_env: *id001
hostgroup: linux
puppetmaster: puppet
When I do a ''*puppet agent -t*'' run on
*puppet-test.card.co.uk*, I get the
following logged:
[gavinw@puppet-test ~]$ sudo puppet agent -t
Info: Retrieving plugin
Info: Loading facts in /var/lib/puppet/lib/facter/oracle_sids.rb
Info: Loading facts in /var/lib/puppet/lib/facter/concat_basedir.rb
Info: Loading facts in /var/lib/puppet/lib/facter/puppet_vardir.rb
Info: Loading facts in /var/lib/puppet/lib/facter/iptables.rb
Info: Loading facts in /var/lib/puppet/lib/facter/root_home.rb
Info: Loading facts in /var/lib/puppet/lib/facter/facter_dot_d.rb
Info: Loading facts in /var/lib/puppet/lib/facter/etckepper_puppet.rb
Info: Caching catalog for puppet-test.card.co.uk
Info: Applying configuration version ''1356087082''
Puppet-test.card.co.uk filername = actint filer
/Stage[main]//Node[puppet-test.card.co.uk]/Notify[puppet-test_notify]/message:
defined ''message'' as ''Puppet-test.card.co.uk
filername = actint filer''
Environment = test
/Stage[main]//Notify[environment]/message: defined ''message''
as
''Environment = test''
Finished catalog run in 3.12 seconds
So puppet agent pulled back a value of ''*actint filer*'', which
is the value
in my ''location'' file.
$ hiera -c hiera.yaml filer_name location=star-int
actint filer
Any ideas why the %{::clientcert} isn''t working?
Cheers
Gavin
--
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/-/7eD8lt64FikJ.
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.
Gavin Williams
2012-Dec-21 14:58 UTC
[Puppet Users] Re: Hiera and ''clientcert'' fact not working :(
Hmmm, that was strange... I launched the puppet master in debug mode to see if I could see where Hiera was going wrong... And it worked :S So restarted the puppet master in normal mode, and it still works... I''m sure I restarted the puppet master several times before posting the above, however can only guess I was doing something wrong. Anyhow, it now works :) Cheers Gavin On Friday, 21 December 2012 11:32:03 UTC, Gavin Williams wrote:> > Morning All > > I''m trying to use Hiera with Puppet 3.0 to streamline some of my module > configuration... > > However I''m having issues using the ''*%{::clientcert}*'' variable as part > of the hierarchy... > > Currently, my *hiera.yaml* file looks like: > --- > :backends: > - yaml > - json > :yaml: > :datadir: /etc/puppet/hieradata > :json: > :datadir: /etc/puppet/hieradata > :hierarchy: > - nodes/%{::clientcert} > - common/%{::location} > - common/%{::environment} > - common/common > > */etc/puppet/hieradata* contains: > -bash-4.1$ ls -R /etc/puppet/hieradata/ > /etc/puppet/hieradata/: > common nodes > > /etc/puppet/hieradata/common: > common.yaml star-int.yaml test.yaml > > /etc/puppet/hieradata/nodes: > puppet-test.card.co.uk.yaml > > Currently I''m just testing with a notify in the *manifests/site.pp* file: > node ''puppet-test.card.co.uk'' { > > $filer_name = hiera(''filer_name'') > notify{''puppet-test_notify'': > message => "Puppet-test.card.co.uk filername = > ${filer_name}" > } > > } > > The hiera values this node *should* be pulling back is: > $ hiera -c hiera.yaml filer_name clientcert=puppet-test.card.co.uk > puppet-test filer > > I am using an ENC with this puppet install, however that all appears to be > working fine aswell... > Node ENC details are: > $ ./node.rb puppet-test.card.co.uk > --- > environment: &id001 test > classes: > - act::products::cms > parameters: > root_pw: xybxa6JUkz63w > location: star-int > foreman_env: *id001 > hostgroup: linux > puppetmaster: puppet > > When I do a ''*puppet agent -t*'' run on *puppet-test.card.co.uk*, I get > the following logged: > [gavinw@puppet-test ~]$ sudo puppet agent -t > Info: Retrieving plugin > Info: Loading facts in /var/lib/puppet/lib/facter/oracle_sids.rb > Info: Loading facts in /var/lib/puppet/lib/facter/concat_basedir.rb > Info: Loading facts in /var/lib/puppet/lib/facter/puppet_vardir.rb > Info: Loading facts in /var/lib/puppet/lib/facter/iptables.rb > Info: Loading facts in /var/lib/puppet/lib/facter/root_home.rb > Info: Loading facts in /var/lib/puppet/lib/facter/facter_dot_d.rb > Info: Loading facts in /var/lib/puppet/lib/facter/etckepper_puppet.rb > Info: Caching catalog for puppet-test.card.co.uk > Info: Applying configuration version ''1356087082'' > Puppet-test.card.co.uk filername = actint filer > /Stage[main]//Node[puppet-test.card.co.uk]/Notify[puppet-test_notify]/message: > defined ''message'' as ''Puppet-test.card.co.uk filername = actint filer'' > Environment = test > /Stage[main]//Notify[environment]/message: defined ''message'' as > ''Environment = test'' > Finished catalog run in 3.12 seconds > > So puppet agent pulled back a value of ''*actint filer*'', which is the > value in my ''location'' file. > $ hiera -c hiera.yaml filer_name location=star-int > actint filer > > Any ideas why the %{::clientcert} isn''t working? > > Cheers > Gavin >-- 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/-/mCff3ZbQwk4J. 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.