Up until recently we've been using puppet in a very basic way. To manage iptables, we created an iptables-save file and loaded it. I want to revamp our iptables management and use the puppetlabs/firewall module.
Best practices suggest that I use .yaml files to deal with this however I'm running into a lot of problems using hiera() and yaml's.
I want common.yaml to have a list of ranges associated with some group:
firewall_group:
localdomain:
- 10.0.0.3/32
- 10.10.0.0/26
anotherdomain:
- 172.0.1.0/26
And I want in some other {$certname}.yaml to contain a list of ports that the host will accept access from from some list of groups:
ports:
ssh:
number: 22
groups:
- localdomain
http:
number: 80
groups:
- localdomain
- anotherdomain
What's the best way to create these firewall rules using puppetlabs/firewall? (Assuming the hiera.yaml looks up these .yaml files correctly) I'm putting the .pp file in custom_fw/manifests/core.pp that init.pp includes.
I've tried using the $ports.each method and the create_resources () method I found searching up "nested yaml loop puppet" but I'm sure I made some error that failed the puppet apply.
Thanks in advance for any insight!