Puppet – Get the IP address of your Puppet Agent by Facts

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:

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s