From 0f4cf8cb431d4e6530bb0cd8ddffd64bf89179e3 Mon Sep 17 00:00:00 2001 From: Boris Manojlovic Date: Tue, 10 Mar 2015 15:19:29 +0100 Subject: [PATCH] add missing AIX network facts discovery --- lib/ansible/module_utils/facts.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/lib/ansible/module_utils/facts.py b/lib/ansible/module_utils/facts.py index 9781bb53ae0..a281717f2eb 100644 --- a/lib/ansible/module_utils/facts.py +++ b/lib/ansible/module_utils/facts.py @@ -2180,6 +2180,34 @@ class AIXNetwork(GenericBsdIfconfigNetwork, Network): else: self.parse_unknown_line(words, current_if, ips) + rc, out, err = module.run_command(['/usr/bin/uname', '-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']): + rc, out, err = module.run_command(['/usr/bin/entstat', 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: + rc, out, err = module.run_command(['/usr/sbin/lsattr','-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