In Puppet, there are a bunch of core facts which are are available for developer to get the Puppet Agent information such as the IP address of a specific network interface card and the free memory. The following piece of code snippet is a very good example on using facts in the manifest.
file {'puppet_facts_example':
ensure => file,
path => '/tmp/puppet_facts_example.txt',
mode => 0644,
content => "This Learning Puppet VM's IP address is ${ipaddress}. It thinks its
hostname is ${fqdn}, but you might not be able to reach it there
from your host machine. It is running ${operatingsystem} ${operatingsystemrelease} and
Puppet ${puppetversion}.
Web console login:
URL: https://${ipaddress_eth0}
User: puppet@example.com
Password: learningpuppet",
}
You can find the list of Puppet core facts in the reference link below.
Done =)
Reference:
