Use IP's of physical interfaces in Template

asked 2017-02-11 07:50:13 -0600

Matt gravatar image

I'm trying to loop through my interfaces, only the physical ones and use them in an Template file.

I'm aware that the addresses can be looked up using facter ( $facts["networking"]["interfaces"]) but how to use only the physical ones ?

Can anyone help me out ?

edit retag flag offensive close merge delete



The easiest way would be to have a standard naming for physical versus virtual. I do not think there is a way natively in puppet to do that. You could return all of them and loop through the hash based on criteria you know to be true for only physical interfaces.

puser gravatar imagepuser ( 2017-02-13 06:24:57 -0600 )edit

Also, if you have some way of identifying your physical interfaces, you could put that into a custom fact, and either use that to reference each interface, or to filter down `$facts["networking"]["interfaces"]` if you need to pull out additional information

DarylW gravatar imageDarylW ( 2017-02-13 07:42:15 -0600 )edit