Difladermaus
2014-Oct-23 19:01 UTC
[Puppet Users] external facter for datacenter from ipaddress - new to puppet
facter --debug returns
Fact file /etc/puppetlabs/facter/facts.d/datacenter.rb was parsed but
returned an empty data set
Any help appreciate
# cat /etc/puppetlabs/facter/facts.d/datacenter.rb
Facter.add("datacenter") do
setcode do
datacenter = "unknown"
# Get current ip address from Facter's own database
ipaddr = Facter.value(:ipaddress)
######################################## HOUSTON data center
if ipaddr.match("^10.220.")
datacenter = "HOUSTON"
######################################## AUSTIN data center
elsif ipaddr.match("^10.221.")
datacenter = "AUSTIN"
end
datacenter
end
end
--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/faf9cf36-1ef0-4ca2-b8f4-767ff0dde037%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.