From ea32c3da767d156dc851abd9d2b5121375b760e8 Mon Sep 17 00:00:00 2001 From: Gaudenz Steinlin Date: Fri, 1 Dec 2017 22:43:13 +0100 Subject: [PATCH] Avoid retrieving IP from a missing bridge On hosts that do not have any containers (ie. computes) network bridges are not needed and may introduce some unwanted overhead. This configuration was possible until Mitaka, but broke with the dynamic-address-fact.yml tasks in Newton. This change checks if the bridge actually exists and otherwise uses the IP configured in the inventory instead. Change-Id: I23668429a19f00f520ac18c76254e83708778d5a --- playbooks/common-tasks/dynamic-address-fact.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/playbooks/common-tasks/dynamic-address-fact.yml b/playbooks/common-tasks/dynamic-address-fact.yml index ea72853c6f..c8078b8911 100644 --- a/playbooks/common-tasks/dynamic-address-fact.yml +++ b/playbooks/common-tasks/dynamic-address-fact.yml @@ -29,7 +29,7 @@ {%- else -%} {%- set _bridge = 'no_bridge_defined' -%} {%- endif -%} - {%- if _bridge != 'no_bridge_defined' and hostvars[inventory_hostname]['ansible_' + _bridge]['ipv4'] is defined-%} + {%- if _bridge != 'no_bridge_defined' and hostvars[inventory_hostname]['ansible_' + _bridge] is defined and hostvars[inventory_hostname]['ansible_' + _bridge]['ipv4'] is defined-%} {{ hostvars[inventory_hostname]['ansible_' + _bridge]['ipv4']['address'] }} {%- elif _network_data['address'] is defined -%} {{ _network_data['address'] }}