Hiera Deep Merge inside create_resources

asked 2018-09-17 10:36:37 -0600

mtenrero gravatar image

Hello, I'm trying to do a merge inside create_resources class but the hash is not being merged correctly, I think the guilty is the hash name for each instance to be configured.

Hiera Global Config

version: 5
  - name: "Common Merge Policy"
    path: "C:/ProgramData/PuppetLabs/code/environments/hieradata/merge_policy.yaml"

  - name: "Node specific configuration"
    path: "C:/ProgramData/PuppetLabs/code/environments/hieradata/%{trusted.certname}.yaml"

  - name: "AppServer specific configuration"
    path: "C:/ProgramData/PuppetLabs/code/environments/%{environment}/hieradata/config.yaml"

Merge Policy

            strategy: deep

Common config

        controller: 8000
        dispatcher: 8102

Node Specific config

            controller: 4000

Crete_Resources called class

define m4appconfig::config_sites (
  $siteparams   = {},
  $servers = {}

The problem is that the retrieved hash is the defined in Node Specific YAML and it's not merged with the Common one in order to populate the whole hash with the default value for the dispatcher key.

I think this could happen because in the node specific YAML i'm specifying a list of instance to configure and inside each instance in the hash I hold all the customized config for each one.

I'm doing this in the correct way? Or should I change my approach?.

Thank you.

edit retag flag offensive close merge delete