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...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/545E898C.5070606%40Alumni.TU-Berlin.de.
For more options, visit https://groups.google.com/d/optout.
$datacenter = $ipaddress ? {
/^10\.220\. => 'HOUSTON',
/^10\.221\. => 'AUSTIN'
}
notice("${::datacenter} data center")
class site {
$datacenter = $ipaddress ? {
/^10\.220\. => 'HOUSTON',
/^10\.221\. => 'AUSTIN'
}
} include 'site'
notice("${::site::datacenter} data center")$datacenter = $ipaddress ? {
/^10\.220\. => 'HOUSTON',
/^10\.221\. => 'AUSTIN'
}
$datacenter = $ipaddress ? {
/^10\.220\./ => 'HOUSTON',
/^10\.221\./ => 'AUSTIN'
}
Hello
I think the advantages of fact based implementation are you can use it in hiera hieracy, query it in puppeydb etc
Neil
P.s. I'd always have a default for a selector like datacenter is
--
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...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/fc8a580a-4da6-494e-978a-6f0888f70f0b%40googlegroups.com.
Hello
I think the advantages of fact based implementation are you can use it in hiera hieracy, query it in puppeydb etc