How can I collect values from Hiera in a hash.
I have wrapper class that I want to use to set up a nginx server, as well as set up firewall ports and selinux ruls.
So I have for example this in my hiera data:
my_nginx::vhosts:
localhost_8081:
listen_port: 8081
www_root: /usr/share/nginx/html
localhost_8082:
listen_port: 8082
www_root: /usr/share/nginx/html
I use this in createsources, with the defined type that comes with the nginx module I use, and this works as expected.
However I also need to create firewall rules. So I add something like this:
iptables::rule { $ports: }
This is done using a custom defined type. In order to tell it which ports need to be opened I have this in hiera:
my_nginx::ports:
- 8081
- 8082
As you can see this means that whenever I add a virtual host to hiera I need to specify the port twice. Is there a way around this? Is there a way to just collect all the "listen_port" values in an array, that I can use to create the iptables::port resources?