Quantcast
Channel: Ask Puppet: Puppet DevOps Q&A Community - RSS feed
Viewing all articles
Browse latest Browse all 6104

How to use a each loop on class parameter

$
0
0
I have a puppet classe with more than 300 parameter (for firewall configuration). I'm using ini_setting to set different module into the firewall. Currently, for every setting, I need to write a ini_setting command EX : ini_setting { "my_": notify => Service['myfirewall'], ensure => present, path => '/etc/firewall.conf', section => '', setting => 'TCP_IN', value => "\"${tcp_in}\"", } Is there a way I could use a each loop to parse all the class parameter at once EX : $classparam.each | String $fieldname, String $value | { $param = upcase(${fieldname}), ini_setting { "my_${fieldname}": notify => Service['myfirewall'], ensure => present, path => '/etc/firewall.conf', section => '', setting => 'TCP_IN', value => "\"${value }\"", } } This would take a fer hundred line out of my module, and make it a lot more readable! Thank you for all input!

Viewing all articles
Browse latest Browse all 6104

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>