Skip to content

Instantly share code, notes, and snippets.

@rnelson0
Last active October 17, 2015 20:19
Show Gist options
  • Save rnelson0/af5b1e368a0e13e71801 to your computer and use it in GitHub Desktop.
Save rnelson0/af5b1e368a0e13e71801 to your computer and use it in GitHub Desktop.
class test (
$override_options = undef
) {
notice($test::override_options)
}
include test
#/home/rnelson0/.puppet/hiera/clientcert/custom.yaml
---
lookupoptions::test::override_options:
merge: deep
test::override_options:
port: 443
#/home/rnelson0/.puppet/hiera/common.yaml
---
test::override_options:
port: 80
bind: 127.0.0.1
---
:backends:
- yaml
:hierarchy:
- clientcert/%{clientcert}
- osfamily/%{osfamily}
- common
:yaml:
:datadir: /home/rnelson0/.puppet/hiera
#substitute your local location
# With hiera_advanced_parameter_bindings disabled (default value)
[rnelson0@build02 puppet:ticket/master/HI-118-auto-merge-lookup±]$ bundle exec puppet config print hiera_advanced_parameter_bindings
false
[rnelson0@build02 puppet:ticket/master/HI-118-auto-merge-lookup±]$ bundle exec puppet apply ~/118.pp
Notice: Scope(Class[Test]): {port => 80, bind => 127.0.0.1}
Notice: Compiled catalog for build02.nelson.va in environment production in 0.08 seconds
Notice: Applied catalog in 0.04 seconds
[rnelson0@build02 puppet:ticket/master/HI-118-auto-merge-lookup±]$ bundle exec puppet apply ~/118.pp --certname=custom
Notice: Scope(Class[Test]): {port => 443}
Notice: Compiled catalog for custom in environment production in 0.10 seconds
Notice: Applied catalog in 0.02 seconds
# With hiera_advanced_parameter_bindings enabled through custom config file.
[rnelson0@build02 puppet:ticket/master/HI-118-auto-merge-lookup±]$ bundle exec puppet config print hiera_advanced_parameter_bindings --confdir ~/.puppet
true
[rnelson0@build02 puppet:ticket/master/HI-118-auto-merge-lookup±]$ bundle exec puppet apply ~/118.pp --confdir ~/.puppet
Notice: Scope(Class[Test]): {port => 80, bind => 127.0.0.1}
Notice: Compiled catalog for build02.nelson.va in environment production in 0.09 seconds
Notice: Applied catalog in 0.05 seconds
[rnelson0@build02 puppet:ticket/master/HI-118-auto-merge-lookup±]$ bundle exec puppet apply ~/118.pp --certname=custom --confdir ~/.puppet
Notice: Scope(Class[Test]): {port => 443, bind => 127.0.0.1}
Notice: Compiled catalog for custom in environment production in 0.08 seconds
Notice: Applied catalog in 0.02 seconds
[main]
hiera_advanced_parameter_bindings = true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment