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.
I want to automate the newrelic-sysmond installation using Puppet and it requires to set the license key in the nrsysmond.cfg and start the agent. And all this steps should happen once only and this can be achieved by creating a text file and only execute if the file does not exist.
We can use 3 placeholders when setting up the mount points as stated in the comment.
# ...
# Mount points may also use three placeholders as part of their path:
#
# %H - The node's certname.
# %h - The portion of the node's certname before the first dot. (Usually the
# node's short hostname.)
# %d - The portion of the node's certname after the first dot. (Usually the
# node's domain name.)
# ...