Closed Dreeg closed 8 years ago
To dynamically generate the rules, variables can be passed:
iptables_rule 'http' do
action :enable
variables ({:http_ports => ['8888','9999']})
end
with the following template:
<% @http_ports.each do |port| %>
-A INPUT -p tcp -m tcp --dport <%= port %> -j ACCEPT
<% end %>
closing via #51
Hi all,
I have to configure about 14 instructions of iptables. If I generate a single template and use iptables_rule, generate correctly file in /etc/sysconfig/iptables but all rules doesn't applied. While, if I write a single template file for every instruction, all work fine.
For ports management I can't create a single template file for every port. It wouldn't be an efficent configuration. How can I write a single (or few) template file(s)?