Issue
What is the best way to get the main network interface name for a Linux server with Ansible? This is often/usually eth0
but we can't always assume this is the case and it would be better to identify this dynamically.
We are configuring the firewall with Ansible so we need to be able to issue the interface name as part of the commands that we are using.
Solution
That should be {{ ansible_default_ipv4.interface }}
. This is a system fact.
Answered By - udondan Answer Checked By - Katrina (WPSolving Volunteer)