]> git.openstreetmap.org Git - chef.git/blob - cookbooks/networking/libraries/interfaces.rb
Merge interface families
[chef.git] / cookbooks / networking / libraries / interfaces.rb
1 module OpenStreetMap
2   module Mixin
3     module Interfaces
4       def interfaces(role: nil)
5         networking = construct_attributes[:networking] || {}
6         networking_interfaces = networking[:interfaces] || {}
7
8         networking_interfaces.each_value.select do |interface|
9           role.nil? || interface[:role].to_s == role.to_s
10         end
11       end
12     end
13   end
14 end
15
16 Chef::Node.include(OpenStreetMap::Mixin::Interfaces)