diff --git a/lib/ansible/module_utils/facts.py b/lib/ansible/module_utils/facts.py index b0e8e6c3b58..c3c4b69f2d4 100644 --- a/lib/ansible/module_utils/facts.py +++ b/lib/ansible/module_utils/facts.py @@ -2263,6 +2263,12 @@ class LinuxNetwork(Network): - ipv4_address and ipv6_address: the first non-local address for each family. """ platform = 'Linux' + INTERFACE_TYPE = { + '1': 'ether', + '512': 'ppp', + '772': 'loopback', + '65534': 'tunnel', + } def populate(self): ip_path = self.module.get_bin_path('ip') @@ -2336,12 +2342,7 @@ class LinuxNetwork(Network): interfaces[device]['module'] = os.path.basename(os.path.realpath(os.path.join(path, 'device', 'driver', 'module'))) if os.path.exists(os.path.join(path, 'type')): _type = get_file_content(os.path.join(path, 'type')) - if _type == '1': - interfaces[device]['type'] = 'ether' - elif _type == '512': - interfaces[device]['type'] = 'ppp' - elif _type == '772': - interfaces[device]['type'] = 'loopback' + interfaces[device]['type'] = self.INTERFACE_TYPE.get(_type, 'unknown') if os.path.exists(os.path.join(path, 'bridge')): interfaces[device]['type'] = 'bridge' interfaces[device]['interfaces'] = [ os.path.basename(b) for b in glob.glob(os.path.join(path, 'brif', '*')) ]