Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Fact: cidr
- # Find the CIDR notation for all the network interfaces
- require 'facter/util/ip'
- Facter::Util::IP.get_interfaces.each do |interface|
- Facter.add("cidr_" + (interface)) do
- setcode do
- Facter::Util::Resolution.exec("/sbin/ip route show | grep `/sbin/ifconfig #{interface} | awk '/inet addr:/{print $2}' | cut -d':' -f2` | cut -d\/ -f2 | cut -d' ' -f1").chomp
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement