Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

What you are seeing is the string version of the array. Are you seeing that when you actually use it, or if you put it in a notify? If you use a notify, it will convert an array into a string. If you are using puppet 4.x, you can try iterating over it, if you are using puppet 3.x, you can pass it to a define/resource and see what is created..

notify{ $groups:
  message => 'You should see this for each member of the array',
}

You should be using AutomaticParameterLookup to actually assign the value to your parameter.

#fqdn.yaml
---
    groups_allowed::adm_group:
      - GROUP1
      - My-Custom-Group

Notice that we start the parameter with the name of the class, followed by the name of an actual parameter for that class. That's how Automatic paramterlookup works. It sees that in hiera, you have a key namespaced like groups_allowed::adm_group. When it looks at the classes it needs to instantiate, it sees a parameter without an explicit value for the class groups_allowed named adm_group, and will assign the value to it.

#init.pp
class groups_allowed (
  $adm_group, #This parameter will contain the array, via automatic parameter lookup, from the hiera configuration
) {
......
}

What you were previously doing was manually using a 'key' to look up a value from hiera. I'm not sure if when you do that lookup, if it will only return a string (depending on your version of puppet).