From 29c3bb48e9dc2530fb99ba610735b062e00497c9 Mon Sep 17 00:00:00 2001 From: Martin Krizek Date: Tue, 18 Dec 2018 21:49:28 +0100 Subject: [PATCH] facts: correctly detect multiple ipv6 addresses per device (#50020) Fixes #49473 --- .../49473-multiple-ipv6-addresses-per-device.yaml | 2 ++ lib/ansible/module_utils/facts/network/linux.py | 10 +++++----- 2 files changed, 7 insertions(+), 5 deletions(-) create mode 100644 changelogs/fragments/49473-multiple-ipv6-addresses-per-device.yaml diff --git a/changelogs/fragments/49473-multiple-ipv6-addresses-per-device.yaml b/changelogs/fragments/49473-multiple-ipv6-addresses-per-device.yaml new file mode 100644 index 0000000000..7ebc0c8901 --- /dev/null +++ b/changelogs/fragments/49473-multiple-ipv6-addresses-per-device.yaml @@ -0,0 +1,2 @@ +bugfixes: + - Correctly detect multiple ipv6 addresses per device in facts (https://github.com/ansible/ansible/issues/49473) diff --git a/lib/ansible/module_utils/facts/network/linux.py b/lib/ansible/module_utils/facts/network/linux.py index 54e2745a2e..074cc6b935 100644 --- a/lib/ansible/module_utils/facts/network/linux.py +++ b/lib/ansible/module_utils/facts/network/linux.py @@ -237,11 +237,11 @@ class LinuxNetwork(Network): scope = words[3] if 'ipv6' not in interfaces[device]: interfaces[device]['ipv6'] = [] - interfaces[device]['ipv6'].append({ - 'address': address, - 'prefix': prefix, - 'scope': scope - }) + interfaces[device]['ipv6'].append({ + 'address': address, + 'prefix': prefix, + 'scope': scope + }) # If this is the default address, update default_ipv6 if 'address' in default_ipv6 and default_ipv6['address'] == address: default_ipv6['prefix'] = prefix