Fix Neutron local_ip fallback

A fallback was added in I954a46443b5434b589226c4999e71bd6ba6a5c0b to
use ansible_ssh_host when no overlay network exists.

However, when the above change is used against hosts that do not use
either an overlay network or an interface named br-mgmt, then the play
will fail with:
One or more undefined variables: 'dict object' has no attribute u'ansible_br_mgmt'

This fixes the change to use the ansible_default_ipv4['interface']
instead of hard-coding br-mgmt.

Change-Id: I21767690c8dd76a4513d8f3d0ac2dfffbd10a026
This commit is contained in:
Logan V 2016-07-06 08:26:44 -05:00 committed by Kevin Carter (cloudnull)
parent fb231fef53
commit 35c4b5529a

View File

@ -170,7 +170,7 @@
- name: set local_ip fact (is_metal)
set_fact:
_local_ip: "{{ hostvars[inventory_hostname]['ansible_' + _overlay_network.bridge|default('br-mgmt')|replace('-', '_')]['ipv4']['address']|default(ansible_ssh_host) }}"
_local_ip: "{{ hostvars[inventory_hostname]['ansible_' + _overlay_network.bridge|default(ansible_default_ipv4['interface'])|replace('-', '_')]['ipv4']['address']|default(ansible_ssh_host) }}"
when:
- is_metal | bool
tags: