1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

facts: add aliases to ansible_all_ipv4_addresses on OpenBSD

This commit is contained in:
verm666 2015-07-02 15:36:56 +03:00
parent 8c29bba2b1
commit d91947ee96

View file

@ -1997,7 +1997,7 @@ class GenericBsdIfconfigNetwork(Network):
return interface['v4'], interface['v6'] return interface['v4'], interface['v6']
def get_interfaces_info(self, ifconfig_path): def get_interfaces_info(self, ifconfig_path, ifconfig_options='-a'):
interfaces = {} interfaces = {}
current_if = {} current_if = {}
ips = dict( ips = dict(
@ -2007,7 +2007,7 @@ class GenericBsdIfconfigNetwork(Network):
# FreeBSD, DragonflyBSD, NetBSD, OpenBSD and OS X all implicitly add '-a' # FreeBSD, DragonflyBSD, NetBSD, OpenBSD and OS X all implicitly add '-a'
# when running the command 'ifconfig'. # when running the command 'ifconfig'.
# Solaris must explicitly run the command 'ifconfig -a'. # Solaris must explicitly run the command 'ifconfig -a'.
rc, out, err = module.run_command([ifconfig_path, '-a']) rc, out, err = module.run_command([ifconfig_path, ifconfig_options])
for line in out.split('\n'): for line in out.split('\n'):
@ -2177,14 +2177,14 @@ class AIXNetwork(GenericBsdIfconfigNetwork, Network):
platform = 'AIX' platform = 'AIX'
# AIX 'ifconfig -a' does not have three words in the interface line # AIX 'ifconfig -a' does not have three words in the interface line
def get_interfaces_info(self, ifconfig_path): def get_interfaces_info(self, ifconfig_path, ifconfig_options):
interfaces = {} interfaces = {}
current_if = {} current_if = {}
ips = dict( ips = dict(
all_ipv4_addresses = [], all_ipv4_addresses = [],
all_ipv6_addresses = [], all_ipv6_addresses = [],
) )
rc, out, err = module.run_command([ifconfig_path, '-a']) rc, out, err = module.run_command([ifconfig_path, ifconfig_options])
for line in out.split('\n'): for line in out.split('\n'):
@ -2264,6 +2264,10 @@ class OpenBSDNetwork(GenericBsdIfconfigNetwork, Network):
""" """
platform = 'OpenBSD' platform = 'OpenBSD'
# OpenBSD 'ifconfig -a' does not have information about aliases
def get_interfaces_info(self, ifconfig_path, ifconfig_options='-aA'):
return super(OpenBSDNetwork, self).get_interfaces_info(ifconfig_path, ifconfig_options)
# Return macaddress instead of lladdr # Return macaddress instead of lladdr
def parse_lladdr_line(self, words, current_if, ips): def parse_lladdr_line(self, words, current_if, ips):
current_if['macaddress'] = words[1] current_if['macaddress'] = words[1]