Puppet Custom Fact

from the video https://puppetlabs.com/webinars/facter-101

Test the fact without a module

  • prepare the environment
mkdir -p ~/custom-fact/lib/facter
export FACTERLIB=~/custom-fact
  • write the custom fact
nano ~/custom-fact/lib/facter/gateway_default.rb 
# gateway_default

Facter.add("gateway_default") do
  setcode do
    cmd = "netstat -r | grep default | awk '{print $2}'"
  • the fact code
 facter | grep gate
gateway_default =>
  • to remove the fact it is necessary remove the variable and run again the facter comand

Test in a module

add the file in this position


look inside the puppet master webconsole

Salvo diversa indicazione, il contenuto di questa pagina è sotto licenza Creative Commons Attribution-ShareAlike 3.0 License