Avoid retrieving IP from a bridge without IP

In some cases, bridges are defined without static IP address.
This patch checks if the bridge has an IP, otherwise skip to the next
method to determine node IP.

Change-Id: I2c79f7dde5b820ae02a6ed09dbb59e690055f5f8
Closes-Bug: #1695274
This commit is contained in:
neith (Jean-Alexis Lauricella) 2017-06-02 16:05:30 +02:00
parent 1986b06d8f
commit 4237287731

View File

@ -29,7 +29,7 @@
{%- else -%} {%- else -%}
{%- set _bridge = 'no_bridge_defined' -%} {%- set _bridge = 'no_bridge_defined' -%}
{%- endif -%} {%- endif -%}
{%- if _bridge != 'no_bridge_defined' -%} {%- if _bridge != 'no_bridge_defined' and hostvars[inventory_hostname]['ansible_' + _bridge]['ipv4'] is defined-%}
{{ hostvars[inventory_hostname]['ansible_' + _bridge]['ipv4']['address'] }} {{ hostvars[inventory_hostname]['ansible_' + _bridge]['ipv4']['address'] }}
{%- elif _network_data['address'] is defined -%} {%- elif _network_data['address'] is defined -%}
{{ _network_data['address'] }} {{ _network_data['address'] }}