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