differnet network interface names

Hi,

I have two servers with different network interface names:

From Ansible facts:

Server A:
“ansible_em0”: {
“active”: true,
“device”: “em0”,

},

Server B:
“ansible_eth0”: {
“active”: true,
“device”: “eth0”,

},

Some of my templates depends on getting IP address of a network interface from Ansible facts.
Is there a easy way how to address it?

I can get it with a script or write a condition for a specific serve type, but it seems to me a little bit hacky :).

Thanks,

Filip

There is the ansible_default_ipv4 fact, which might work for you.

There’s a fact for the default interface that may fit your requirements.

Thx guys! I totally miss that one.