summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Scherer <mscherer@users.noreply.github.com>2016-11-07 18:00:26 +0100
committerBrian Coca <bcoca@users.noreply.github.com>2016-11-07 12:00:26 -0500
commit150ea49d8a8e62941f87a83bd9b570b22e319a7e (patch)
tree589825df315c72158d9dbd39b9dfa7a8045e2843
parentdf145df9628b16042ddd1ec5e87bbf924d7812c1 (diff)
downloadansible-150ea49d8a8e62941f87a83bd9b570b22e319a7e.tar.gz
Add tunnel linux (#18118)
* Refactor the type selection of network device under linux * Add the tunnel type to the type of net interface under Linux
-rw-r--r--lib/ansible/module_utils/facts.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/ansible/module_utils/facts.py b/lib/ansible/module_utils/facts.py
index b0e8e6c3b5..c3c4b69f2d 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', '*')) ]