Shubham Sharma
Shubham Sharma

Reputation: 21

Public Ip address of puppet agent

I am using Puppet for automation purpose. How can I get public IP address of agent machine connected to puppetserver. I want to use that IP address in my puppet manifest file.

Upvotes: 0

Views: 701

Answers (1)

John Bollinger
John Bollinger

Reputation: 180201

The Puppet agent provides a set of facts about itself and its host as part of each catalog request. These are available to the catalog builder as top-scope variables, and also via the top-scope $facts hash. They include information about network interfaces and, in particular, IP addresses.

Do note, however, that machines typically have multiple IP addresses (including local addresses), some even have multiple routable addresses, and some must be referred to by different addresses in one network location than they are in others. Thus, the "public IP address" of a machine is not necessarily well- or uniquely defined. Facter does take a guess as to a single IP address for machines with IP networking, but you should not rely on that without an awareness of these issues.

Upvotes: 1

Related Questions