mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Allows network network interface facts collection as an unprivileged user and adds more facts
This commit is contained in:
parent
e181bcf62b
commit
4614a574ea
1 changed files with 20 additions and 0 deletions
|
@ -2278,6 +2278,26 @@ class AIXNetwork(GenericBsdIfconfigNetwork, Network):
|
|||
"""
|
||||
platform = 'AIX'
|
||||
|
||||
def get_default_interfaces(self, route_path):
|
||||
netstat_path = module.get_bin_path('netstat')
|
||||
|
||||
rc, out, err = module.run_command([netstat_path, '-nr'])
|
||||
|
||||
interface = dict(v4 = {}, v6 = {})
|
||||
|
||||
lines = out.split('\n')
|
||||
for line in lines:
|
||||
words = line.split()
|
||||
if len(words) > 1 and words[0] == 'default':
|
||||
if '.' in words[1]:
|
||||
interface['v4']['gateway'] = words[1]
|
||||
interface['v4']['interface'] = words[5]
|
||||
elif ':' in words[1]:
|
||||
interface['v6']['gateway'] = words[1]
|
||||
interface['v6']['interface'] = words[5]
|
||||
|
||||
return interface['v4'], interface['v6']
|
||||
|
||||
# AIX 'ifconfig -a' does not have three words in the interface line
|
||||
def get_interfaces_info(self, ifconfig_path, ifconfig_options):
|
||||
interfaces = {}
|
||||
|
|
Loading…
Reference in a new issue