> host has one). I've not ventured down the custom fact road before so > this should be an little adventure.
Your version certainly will work. I think this is how I might take a stab at it though: require 'facter' require 'ipaddr' require 'yaml' Facter.add("nsd_gateway") do setcode do begin interfaces = Facter.value(:interfaces).split(',') nsd_gateway = nil interfaces.each do |iface| next unless (address = Facter.value("ipaddress_#{iface}")) YAML::load(File.open('/usr/local/etc/config.yml')) ['nsd_networks'].each do |net| net = IPAddr.new(net) nsd_gateway = address if net.include?(address) end end nsd_gateway end end end Where your '/usr/local/etc/config.yml' file contains a definition of your nsd_networks: --- nsd_networks: - 14.1.22.0/24 - 19.7.28.0/24 - 15.0.8.0/24 > Thanks for the alternate idea on using templating to solve the > problem. I had not thought of that approach! No problem. I can't envision it offhand, but you *might* also be able to do it in a define. But youve already solved it for now. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-us...@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.