summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Coca <bcoca@ansible.com>2015-03-10 15:59:34 -0400
committerBrian Coca <bcoca@ansible.com>2015-03-10 15:59:34 -0400
commit17c710e713926d7c817d20c96565b5c976b96269 (patch)
tree789b6467890a72c1566310767a778289415a7807
parent39a3d6f5eddd606e7265bd1e15e76845743a29cb (diff)
parenta59784a5818655bb79967e98140908468d663065 (diff)
downloadansible-17c710e713926d7c817d20c96565b5c976b96269.tar.gz
Merge pull request #10420 from bmanojlovic/devel
add missing AIX network facts discovery
-rw-r--r--lib/ansible/module_utils/facts.py35
1 files changed, 34 insertions, 1 deletions
diff --git a/lib/ansible/module_utils/facts.py b/lib/ansible/module_utils/facts.py
index 54a2eac6ec..06b224759c 100644
--- a/lib/ansible/module_utils/facts.py
+++ b/lib/ansible/module_utils/facts.py
@@ -2179,7 +2179,40 @@ class AIXNetwork(GenericBsdIfconfigNetwork, Network):
self.parse_inet6_line(words, current_if, ips)
else:
self.parse_unknown_line(words, current_if, ips)
-
+ uname_path = module.get_bin_path('uname')
+ if uname_path:
+ rc, out, err = module.run_command([uname_path, '-W'])
+ # don't bother with wpars it does not work
+ # zero means not in wpar
+ if out.split()[0] == '0':
+ if current_if['macaddress'] == 'unknown' and re.match('^en', current_if['device']):
+ entstat_path = module.get_bin_path('entstat')
+ if entstat_path:
+ rc, out, err = module.run_command([entstat_path, current_if['device'] ])
+ if rc != 0:
+ break
+ for line in out.split('\n'):
+ if not line:
+ pass
+ buff = re.match('^Hardware Address: (.*)', line)
+ if buff:
+ current_if['macaddress'] = buff.group(1)
+
+ buff = re.match('^Device Type:', line)
+ if buff and re.match('.*Ethernet', line):
+ current_if['type'] = 'ether'
+ # device must have mtu attribute in ODM
+ if 'mtu' not in current_if:
+ lsattr_path = module.get_bin_path('lsattr')
+ if lsattr_path:
+ rc, out, err = module.run_command([lsattr_path,'-El', current_if['device'] ])
+ if rc != 0:
+ break
+ for line in out.split('\n'):
+ if line:
+ words = line.split()
+ if words[0] == 'mtu':
+ current_if['mtu'] = words[1]
return interfaces, ips
# AIX 'ifconfig -a' does not inform about MTU, so remove current_if['mtu'] here