D
D
DenZel2020-02-16 15:05:07
linux
DenZel, 2020-02-16 15:05:07

How to pull out the network interface name of a remote server using Ansible?

Hello!
There is a ready-made iptables config, which is uploaded to remote vps using ansible.
But different servers may have different network interface names ens0, eth0, etc.
Here is the best way to implement a mechanism for reading the interface name from the vps, then using it in the template module for the iptables file.
Help build the right procedure.
Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Shitskov, 2020-02-16
@gen4_gdm

The facts have ansible_interfaces array
https://docs.ansible.com/ansible/latest/user_guide...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question