Hi Albert Here's a custom parser function that can resolve names:
require "resolv" module Puppet::Parser::Functions newfunction( :name2ip, :type => :rvalue, :doc => "name2ip( hostname ) => ip_address" ) do |arguments| raise(Puppet::ParseError, "name2ip(): Wrong number of arguments given (#{arguments.size} for 1)") if arguments.size < 1 name = arguments[0] begin return Resolv.getaddress(name) rescue begin return Resolv::Hosts.new.getaddress(name) rescue raise(Puppet::Error, "Can't resolve host name '#{name}' to an IP address") end end end end On Monday, 14 November 2016 23:41:29 UTC+2, Albert Shih wrote: > > > -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/ed9160af-82e5-4131-aae0-84dfaa8a507a%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.