class classA {
notice("ClassA")
}
class classB ($param1 = '') { #This uses the auto lookup of parameters. It will perform a hiera search for 'classB::param1'.
notice ("ClassB: ParamValue $param1")
}
}
}
I am looking for few clarifications on puppet-hiera integration.
Trying to move away completly from using site.pp. For that I started exploring Hiera. End of the day I want an external system prepare yaml files automatucally based on user requests.
Environment: Ubuntu12.04, PE 2.7, Hiera 1.1.2
EX:
class classA {
notice("ClassA")
}class classB ($param1 = '') {
notice ("ClassB: ParamValue $param1")
}
Now I am want to include these two classes into two different nodes, so prepared two yaml fileshiera.yaml
---
:hierarchy:
- %{::clientcert}
- common
:backends:
- yaml
:yaml:
:datadir: '/etc/puppetlabs/puppet/hieradata'NodeA.yaml
---
emcutil::a:
- aNodeB.yaml
---
classesH:
emcutil::b:
param1: 'Puppet-Hiera'
As I have classes as array and hash, so added below code in site.pp default section so that I can include hash and arrays.
node default {
hiera_include('classesA','')
$param_packagesH = hiera_hash('classesH')
create_resources('class',$param_classesH)
}
}This approach does not work.
On NodeA following error:
err: Could not retrieve catalog from remote server: Error 400 on SERVER: undefined method `empty?' for nil:NilClass at /etc/puppetlabs/puppet/environments/development/manifests/site.pp:48 on nodeOn NodeB following error:
err: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not find data item classesA in any Hiera data file and no default supplied at /etc/puppetlabs/puppet/environments/development/manifests/site.pp:46 on node
What I am doing here is valid?
If we are using hiera_include or hiera_hash all the node yaml files should have all the targets and the target returns not null values?Do we have alternatives other than using hiera, hiera_include and hiera_hash?
PE 2.7 do we need to do any configuration for Hiera, apart from puppet-hiera package. Specifically related to these two attributes node_terminus, external_nodes?
With Hiera we can move away from site.pp completly. My understanding is correct on Hiera?Any help on this greatly appreciated.
Sai.
EMC Corporation.