Hi list!
I have a problem integrating puppet and hiera.
Our puppet-master and all nodes are running puppet 3.6.2. On the master,
hiera version 1.3.4 is installed.
I want to use some hiera-data in a class depending on the node. To be
less abstract, I have this class:
class memcached::server{
$cap = hiera('memcached.cap', 64)
# package and service omitted here
if is_integer($cap) {
file { '/etc/memcached.conf':
ensure => present,
content => template('memcached/memcached.conf.erb'),
notify => Service['memcached'];
}
} else {
fail("memory \$cap should be an integer")
}
}
In a future refactoring, I may promote $cap to be a class-parameter
and also use the validation from the stdlib.
But first, I want to get 'memcached.cap' from a node-specific file.
Puppet is configured with "hiera_config = /etc/puppet/hiera.yaml".
The file /etc/puppet/hiera.yaml is as follows:
---
:backends: yaml
:yaml:
:datadir: /var/lib/hiera
:hierarchy:
- %{clientcert}
- common
:logger: console
This is - from the docs - the internal default with just one hierarchy added.
I do not have the value "memcached.cap" in the /var/lib/hiera/common.yaml
memcached.cap: 256
Using this configs manually via the CLI, I get the expected result:
$ sudo hiera memcached.cap -d -c /etc/puppet/hiera.yaml -y /var/lib/puppet/yaml/facts/shop-01.hoster.de.yaml
DEBUG: Wed Jul 23 18:49:39 +0200 2014: Hiera YAML backend starting
DEBUG: Wed Jul 23 18:49:39 +0200 2014: Looking up memcached.cap in YAML backend
256
So far, everything is nice. BTW, when I change the %{clientcert} to
%{::clientcert} is does work through the CLI anymore.
I cannot get the same data through puppet.
What am I doing wrong? Where - apart from the source-code - can I look
for information how that lookup works?
Thanks,
Matthias Viehweger