Last active
August 29, 2015 14:10
-
-
Save zanshin/236ecd36e1dfe22a6854 to your computer and use it in GitHub Desktop.
firewall_rules.rb
This file contains hidden or 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
# determine if we are an alpha or production node | |
if node.chef_environment == "ome-alpha" | |
local_environment = "alpha" | |
else | |
local_environment = "prod" | |
end | |
# get the list of nodes... | |
sources = search(:node, "tags:#{node['memcached']['memcached_instance']} AND tags:#{local_environment}") | |
sources.each do |source| | |
firewall_rule "allow ips" do | |
source "#{source['ipaddress']}" | |
port node['memcached']['port'] | |
protocol :tcp | |
action :allow | |
notifies :enable, 'firewall[ufw]' | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment