From af150ea43ad6f6dd83ee975f2d11cb55b3dc689c Mon Sep 17 00:00:00 2001 From: Zempashi Date: Fri, 17 Jun 2016 23:10:45 +0200 Subject: [PATCH] Fix linux 'ip' stdout parsing. (#16170) With network-manager in debian (stretch) and openvpn connection enabled the output for ipv6 is different and include a 'peer' keyword. Fixes #15448 --- lib/ansible/module_utils/facts.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/ansible/module_utils/facts.py b/lib/ansible/module_utils/facts.py index 823d3e59f54..3f195a9a04f 100644 --- a/lib/ansible/module_utils/facts.py +++ b/lib/ansible/module_utils/facts.py @@ -2229,8 +2229,13 @@ class LinuxNetwork(Network): if not address.startswith('127.'): ips['all_ipv4_addresses'].append(address) elif words[0] == 'inet6': - address, prefix = words[1].split('/') - scope = words[3] + if 'peer' == words[2]: + address = words[1] + _, prefix = words[3].split('/') + scope = words[5] + else: + address, prefix = words[1].split('/') + scope = words[3] if 'ipv6' not in interfaces[device]: interfaces[device]['ipv6'] = [] interfaces[device]['ipv6'].append({