]> git.openstreetmap.org Git - chef.git/blob - cookbooks/networking/libraries/ipaddresses.rb
Don't disable loopback connection tracking on 14.04
[chef.git] / cookbooks / networking / libraries / ipaddresses.rb
1 class Chef
2   class Node
3     def ipaddresses(options = {}, &block)
4       addresses = []
5
6       interfaces(options).each do |interface|
7         address = interface[:public_address] || interface[:address]
8
9         if block.nil?
10           addresses << address
11         else
12           yield address
13         end
14       end
15
16       addresses
17     end
18
19     def internal_ipaddress
20       ipaddresses(:role => :internal).first
21     end
22
23     def external_ipaddress
24       ipaddresses(:role => :external).first
25     end
26   end
27 end