Following the example at http://docs.puppetlabs.com/hiera/1/complete_example.html
-
How to print all elements in a Hiera array, per https://ask.puppetlabs.com/question/11181/why-doesnt-hiera-append-the-vmware-classs-to-my-classes-array/
-
Printing Hiera arrays within Puppet
[root@puppet3 puppet]# puppet apply -e '$message = hiera_array(classes) notify { $message: }'
Notice: Compiled catalog for puppet3.example.org in environment production in 0.03 seconds
Notice: vmwaretoolsnn
Notice: /Stage[main]/Main/Notify[vmwaretools]/message: defined 'message' as 'vmwaretools'
Notice: epel
Notice: /Stage[main]/Main/Notify[epel]/message: defined 'message' as 'epel'
Notice: stefan-yum
Notice: /Stage[main]/Main/Notify[stefan-yum]/message: defined 'message' as 'stefan-yum'
Notice: motd
Notice: /Stage[main]/Main/Notify[motd]/message: defined 'message' as 'motd'
Notice: stefan-puppet
Notice: /Stage[main]/Main/Notify[stefan-puppet]/message: defined 'message' as 'stefan-puppet'
Notice: ntp
Notice: /Stage[main]/Main/Notify[ntp]/message: defined 'message' as 'ntp'
Notice: users
Notice: /Stage[main]/Main/Notify[users]/message: defined 'message' as 'users'
Notice: Finished catalog run in 0.04 seconds
[root@puppet3 puppet]# puppet apply -e "notice hiera_array(classes)"
Notice: Scope(Class[main]): vmwaretools stefan-yum ntp motd stefan-puppet epel users
Notice: Compiled catalog for puppet3.example.org in environment production in 0.02 seconds
Notice: Finished catalog run in 0.03 seconds
- Printing arrays using Hiera on the commandline:
[root@puppet3 puppet]# hiera --array classes
["ntp", "motd", "stefan-puppet", "epel", "users"]
[root@puppet3 puppet]# hiera --array classes ::virtual=vmware
["vmwaretools", "ntp", "motd", "stefan-puppet", "epel", "users"]