Hiera and 'clientcert' fact not working :(

894 views
Skip to first unread message

Gavin Williams

unread,
Dec 21, 2012, 6:32:03 AM12/21/12
to puppet...@googlegroups.com
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

Gavin Williams

unread,
Dec 21, 2012, 9:58:54 AM12/21/12
to puppet...@googlegroups.com
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
Reply all
Reply to author
Forward
0 new messages