Created
September 13, 2013 22:08
-
-
Save ranjib/6556743 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template "/etc/sysconfig/iptables" do | |
extend Helper | |
source "chef_iptables_ruleset.erb" | |
owner = "root" | |
mode "0600" | |
variables( | |
:static_inbound => static_inbound_ruleset, | |
:dynamic_inbound => dynamic_inbound_ruleset, | |
:static_outbound => static_outbound_ruleset, | |
:dynamic_outbound => dynamic_outbound_ruleset | |
) | |
notifies :restart, "service[iptables]" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Helper | |
def static_inbound_ruleset | |
ruleset.static_inbound_ruleset.uniq | |
end | |
def dynamic_inbound_ruleset | |
ruleset.dynamic_inbound_ruleset.uniq | |
end | |
def static_outbound_ruleset | |
ruleset.static_outbound_ruleset.uniq | |
end | |
def dynamic_outbound_ruleset | |
ruleset.dynamic_outbound_ruleset.uniq | |
end | |
def ruleset | |
@ruleset ||= IptablesRules.new node | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment