4. External facts
• Embedded in hostname: dc01-r3-prod-web04
• Facts files: /etc/puppetlabs/facter/facts.d/ or
<module>/facts.d/
– Files may be txt, json, yaml, or scripts
– Dir must be created
facts.txt:
datacenter=portland
application=doc
team=TSE
8. Custom facts - precedence
Facter.add(:rubypath) do
has_weight 100
setcode 'which ruby'
end
Facter.add(:rubypath) do
has_weight 50
setcode do
’I dont know!’
end
end
9. Aggregates
• Structured facts can be aggregated chuncks
• :type => :aggregate
chunk(:one) do
'Chunk one returns this. '
end
chunk(:two) do
'Chunk two returns this.'
end
OR
aggregate do |chunks|
…
end