From 2606c23812be510c1f8ced03a5e0c32a218d827d Mon Sep 17 00:00:00 2001 From: Pierre Riteau Date: Wed, 16 Sep 2020 15:28:54 +0200 Subject: [PATCH] Avoid setting IPADDR=0.0.0.0 Configuring network interfaces with IPADDR=0.0.0.0 may fail with: Error, some other host (FF:FF:FF:FF:FF:FF) already uses address 0.0.0.0. Change-Id: I908dc3320cb1dce7a040a1dbfeac414ace22d6e3 Co-Authored-By: Bartosz Bezak Story: 2007900 Task: 40289 --- ansible/filter_plugins/networks.py | 18 ++++++++++++------ ...fix-no-ip-addr-on-nic-38d6f8e8078f534d.yaml | 6 ++++++ 2 files changed, 18 insertions(+), 6 deletions(-) create mode 100644 releasenotes/notes/fix-no-ip-addr-on-nic-38d6f8e8078f534d.yaml diff --git a/ansible/filter_plugins/networks.py b/ansible/filter_plugins/networks.py index caff302dd..f32ad0d04 100644 --- a/ansible/filter_plugins/networks.py +++ b/ansible/filter_plugins/networks.py @@ -200,11 +200,13 @@ def net_interface_obj(context, name, inventory_hostname=None): "Network interface for network '%s' on host '%s' not found" % (name, inventory_hostname)) ip = net_ip(context, name, inventory_hostname) - if ip is None: - ip = '0.0.0.0' cidr = net_cidr(context, name, inventory_hostname) netmask = net_mask(context, name, inventory_hostname) gateway = net_gateway(context, name, inventory_hostname) + if ip is None: + ip = '' + gateway = None + netmask = None vlan = net_vlan(context, name, inventory_hostname) mtu = net_mtu(context, name, inventory_hostname) routes = net_routes(context, name, inventory_hostname) @@ -248,11 +250,13 @@ def net_bridge_obj(context, name, inventory_hostname=None): "Network interface for network '%s' on host '%s' not found" % (name, inventory_hostname)) ip = net_ip(context, name, inventory_hostname) - if ip is None: - ip = '0.0.0.0' cidr = net_cidr(context, name, inventory_hostname) netmask = net_mask(context, name, inventory_hostname) gateway = net_gateway(context, name, inventory_hostname) + if ip is None: + ip = '' + gateway = None + netmask = None vlan = net_vlan(context, name, inventory_hostname) mtu = net_mtu(context, name, inventory_hostname) ports = net_bridge_ports(context, name, inventory_hostname) @@ -298,11 +302,13 @@ def net_bond_obj(context, name, inventory_hostname=None): "Network interface for network '%s' on host '%s' not found" % (name, inventory_hostname)) ip = net_ip(context, name, inventory_hostname) - if ip is None: - ip = '0.0.0.0' cidr = net_cidr(context, name, inventory_hostname) netmask = net_mask(context, name, inventory_hostname) gateway = net_gateway(context, name, inventory_hostname) + if ip is None: + ip = '' + gateway = None + netmask = None vlan = net_vlan(context, name, inventory_hostname) mtu = net_mtu(context, name, inventory_hostname) mode = net_bond_mode(context, name, inventory_hostname) diff --git a/releasenotes/notes/fix-no-ip-addr-on-nic-38d6f8e8078f534d.yaml b/releasenotes/notes/fix-no-ip-addr-on-nic-38d6f8e8078f534d.yaml new file mode 100644 index 000000000..c4b5ff935 --- /dev/null +++ b/releasenotes/notes/fix-no-ip-addr-on-nic-38d6f8e8078f534d.yaml @@ -0,0 +1,6 @@ +--- +fixes: + - | + Fixes issues when network interfaces are configured without IP addresses. + See `story 2007900 `__ + for details.