In puppet, the core fact ipaddress
surely provides me with the agents private ipaddress.
Is there also a shortcut to retrieve the external ip address in an erb-template?
I guess I may have to write a small function for it.
The ipaddress
fact just "does an ifconfig
and returns the first non 127.0.0.0/8 subnetted IP it finds". The code is here. There are also facts available for the specific interfaces (ipaddress_eth0
etc). You may need to write a custom fact as you say, and it's very easy to do so. (Documentation here).
All facts are available inside an ERB template as:
<%= @ipaddress %>
etc.