eid-ops/global/overlay/etc/puppet/modules/eid/functions/dnsLookup.rb
2022-03-17 18:53:58 +01:00

14 lines
429 B
Ruby

# dnsLookup.rb
# does a DNS lookup and returns an array of strings of the results
# from http://geek.jasonhancock.com/2011/04/20/doing-a-dns-lookup-inside-your-puppet-manifest/
require 'resolv'
module Eid::Functions
newfunction(:dnsLookup, :type => :rvalue) do |args|
result = []
result = Resolv.new.getaddresses(args[0])
debug("resolving #{args[0]} to #{result}")
return result
end
end