I'm trying to override a single item in the containers hash, but I don't understand why it isn't merging the contents from both yaml files - everything I've read so far says that this is supposed to work:

1 Answer

First of all, you're using a hiera configuration format and hiera function calls from a version of Puppet that's end-of-life for a year now. You really should upgrade to Hiera v5 and use the lookup() function: https://puppet.com/docs/puppet/5.3/hi...

But the issue here is that you haven't requested a merge, so you are getting "first" lookup. In new terms, you are doing this:

lookup('containers', {merge => first})

When you need to request a merge type. Since you want to override a value within a hash, you'll need a 'deep' merge:

lookup('containers', {merge => deep})

If you forced to use an EOL version of puppet, you can get the merge behavior by using hiera_hash('containers') and putting the following in your hiera.yaml.
:merge_behavior: deep

The old Hiera the merge parameter is global, not configurable on a per-lookup basis so all hiera_hash calls will be merged deep. This is a good reason to upgrade!

It sounds like you are new to Puppet. 3.8.7 is the dead end run of a lot of history you don't need to be held back by. Get the Puppet Development Kit and work with a better designed, lessons learned version of Puppet.