summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorverm666 <verm666@gmail.com>2015-07-02 15:36:56 +0300
committerBrian Coca <brian.coca+git@gmail.com>2015-07-03 13:58:32 -0400
commit15ad02102ee79bf862d973041ae5f66dfb6884de (patch)
tree6644459b35275894a0d70ca8a21280b78dca71cd
parent5e78c5c672d9a29fde80c2ee0faf3471581df232 (diff)
downloadansible-15ad02102ee79bf862d973041ae5f66dfb6884de.tar.gz
facts: add aliases to ansible_all_ipv4_addresses on OpenBSD
-rw-r--r--lib/ansible/module_utils/facts.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/ansible/module_utils/facts.py b/lib/ansible/module_utils/facts.py
index 998c493b64..bca210e027 100644
--- a/lib/ansible/module_utils/facts.py
+++ b/lib/ansible/module_utils/facts.py
@@ -1975,7 +1975,7 @@ class GenericBsdIfconfigNetwork(Network):
return interface['v4'], interface['v6']
- def get_interfaces_info(self, ifconfig_path):
+ def get_interfaces_info(self, ifconfig_path, ifconfig_options='-a'):
interfaces = {}
current_if = {}
ips = dict(
@@ -1985,7 +1985,7 @@ class GenericBsdIfconfigNetwork(Network):
# FreeBSD, DragonflyBSD, NetBSD, OpenBSD and OS X all implicitly add '-a'
# when running the command 'ifconfig'.
# 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'):
@@ -2155,14 +2155,14 @@ class AIXNetwork(GenericBsdIfconfigNetwork, Network):
platform = 'AIX'
# 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 = {}
current_if = {}
ips = dict(
all_ipv4_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'):
@@ -2242,6 +2242,10 @@ class OpenBSDNetwork(GenericBsdIfconfigNetwork, Network):
"""
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
def parse_lladdr_line(self, words, current_if, ips):
current_if['macaddress'] = words[1]