user630702
user630702

Reputation: 3167

Yaml / Puppet - Get interface name only with nameservers in the yaml config

How to get interface name which has nameservers defined?

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

The Yaml file I want to refer is the netplan config file and its content looks like this:

    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]

Upvotes: 0

Views: 247

Answers (0)

Related Questions