Merge "Add ansible_nodename (system hostname) to /etc/hosts"

This commit is contained in:
Zuul 2019-06-07 09:08:08 +00:00 committed by Gerrit Code Review
commit 796980aa3f
2 changed files with 9 additions and 1 deletions

View File

@ -24,7 +24,8 @@
{% for host in groups['baremetal'] %}
{% set api_interface = hostvars[host]['api_interface'] %}
{% if host not in groups['bifrost'] or 'ansible_' + api_interface in hostvars[host] %}
{{ hostvars[host]['ansible_' + api_interface]['ipv4']['address'] }} {{ hostvars[host]['ansible_hostname'] }}
{% set hostnames = [hostvars[host]['ansible_nodename'], hostvars[host]['ansible_hostname']] %}
{{ hostvars[host]['ansible_' + api_interface]['ipv4']['address'] }} {{ hostnames | unique | join(' ') }}
{% endif %}
{% endfor %}
become: True

View File

@ -0,0 +1,7 @@
---
fixes:
- |
Adds system hostnames to ``/etc/hosts``, if different from short hostnames.
This can fix live migration of Nova instances in some contexts. See `bug
1830023 <https://bugs.launchpad.net/kolla-ansible/+bug/1830023>`__ for
details.