I have been doing some experimenting with Puppet + Hiera with some of my 
hashes, but when it is going through my hierarchy it is returning whatever 
hash it hits first and skipping the others.

For my node 'sandbox1'

sandbox.pp:

node /^sandbox\d+/ {
  class { 'php':}
  notify { 'PHP hash':
    message => hiera('php::augeas',{})
  }
  $php_settings = hiera('php::augeas',{})
  create_resources('php::augeas',$php_settings)
}


hiera.yaml:

---
:backends:
  - json
:json:
  :datadir: /etc/puppet/hiera
:merge_behavior: "deeper"
:hierarchy:
  - "nodes/%{::hostname}"
  - "roles/%{::role}"
  - "provider/%{::provider}"
  - "provider/%{::provider}/virtual/virtual_%{::is_virtual}"
  - common


hiera/nodes/sandbox1.json:

{
    "php::augeas" : {
        "php-allow_url_fopen" : {
            "entry"   : "PHP/allow_url_fopen",
            "value"   : "On"
        }
    }
}


hiera/roles/sandbox.json:

{
    "php::augeas" : {
        "php-log_errors" : {
            "entry"   : "PHP/log_errors",
            "value"   : "On"
        }
    }
} 


hiera/common.json:

{
    "php::augeas" : {
        "php-date_timezone" : {
            "entry"   : "Date/date.timezone",
            "value"   : "America/New_York"
        },
        "php-short_open_tag" : {
            "entry"   : "PHP/short_open_tag",
            "value"   : "On"
        },
        "php-error_log" : {
            "entry"   : "PHP/error_log",
            "value"   : "/var/log/php/php_error.log"
        }
    }
} 


In this configuration, *only  "php-allow_url_fopen" **from the top-level 
nodes hash is returned*. If I remove that nodes/sandbox1.json, it only 
returns the "php-log_errors" from the next "roles" hiera level down. 
Finally, if the nodes and roles json's are removed it will apply all three 
from the common.json hash.

I have tried both native and deeper merge behaviors with the same result. 
The strangest thing is that the hiera command line tool on the master 
returns the correct hash:

# hiera -h php::augeas ::hostname=sandbox1 ::role=sandbox -c 
/etc/puppet/hiera.yaml

{"php-date_timezone"=>
  {"entry"=>"Date/date.timezone", "value"=>"America/New_York"},
 "php-short_open_tag"=>{"entry"=>"PHP/short_open_tag", "value"=>"On"},
 "php-error_log"=>
  {"entry"=>"PHP/error_log", "value"=>"/var/log/php/php_error.log"},
 "php-log_errors"=>{"entry"=>"PHP/log_errors", "value"=>"On"},
 "php-allow_url_fopen"=>{"entry"=>"PHP/allow_url_fopen", "value"=>"On"}}


-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/96454179-6cd7-4c54-9ec2-2bf553e319a9%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to