ansible facts for interface aliases

Hi

If you have ip aliases so called ipv4 secondaries configured, you get this from setup:

“ansible_bond0”: {
“active”: true,
“device”: “bond0”,
“ipv4”: {
“address”: “10.100.219.17”,
“netmask”: “255.255.255.0”,
“network”: “10.100.219.0”
},
“ipv4_secondaries”: [
{
“address”: “10.100.219.18”,
“netmask”: “255.255.255.0”,
“network”: “10.100.219.0”
}
],
“ipv6”: [
{
“address”: “fe80::250:56ff:fe9e:10d4”,
“prefix”: “64”,
“scope”: “link”
}
],
“macaddress”: “00:50:56:9e:10:d4”,
“module”: “vmxnet3”,
“mtu”: 1500,
“promisc”: false,
“type”: “ether”
},
“ansible_bond0_0”: {
“ipv4_secondaries”: [
{
“address”: “10.100.219.18”,
“netmask”: “255.255.255.0”,
“network”: “10.100.219.0”
}
]
},

the “ansible_bond0”: part looks good. But in the “ansible_bond0_0” part, I expected to have the following (without the array ).

“ansible_bond0_0”: {
“ipv4_secondaries”: {
“address”: “10.100.219.18”,
“netmask”: “255.255.255.0”,
“network”: “10.100.219.0”
}
},

ifconfig

bond0 Link encap:Ethernet HWaddr 00:50:56:9E:10:D4
inet addr:10.100.219.17 Bcast:10.100.219.255 Mask:255.255.255.0
inet6 addr: fe80::250:56ff:fe9e:10d4/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:234982 errors:0 dropped:0 overruns:0 frame:0
TX packets:258833 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:66325373 (63.2 MiB) TX bytes:18960200 (18.0 MiB)

bond0:0 Link encap:Ethernet HWaddr 00:50:56:9E:10:D4
inet addr:10.100.219.18 Bcast:10.100.219.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

Or can you explain, why there is an array defined for this ifce?

Regards
René

Or can you explain, why there is an array defined for this ifce?

Interface aliases are deprecated in Linux. Expect weird behaviour. ipv4_secondaries is exactly the same for bond0 and bond0_0. iproute2 allows you to add any number of ip addresses to an interface. To handle the generic case, it has to be an array.

Cheers,
Paul