1

How to get interface name which has nameservers defined?

I want to get the interface name so I can pass it to another netplan puppet module so the nameservers can be replaced. But I only want to get the interface name (ens160) which has nameservers configured.

    ethernets:
            ens160:
                dhcp4: no
                addresses: [10.10.10.10/24]
                gateway4: 10.10.10.1
                nameservers:
                    addresses: [20.20.20.20, 30.30.30.30]
                    search: [mydomain.local]
            ens192:
                dhcp4: no
                addresses: [10.10.10.20/24]
user630702
  • 465
  • 6
  • 25

0 Answers0