Include hostnames in /etc/hosts

Include the resolution of the hostname to the private IPv4 for all
hosts in multinode setups.
Currently we only setup the inventory name, which is not enough
since qemu relies on the hostname for live migration.

Change-Id: I717f5f8b5b803abe874bea498fd07f5508cc7214
This commit is contained in:
Andrea Frittoli 2018-06-05 10:23:01 +01:00 committed by Andrea Frittoli (andreaf)
parent b457191d14
commit 13b96b4bc6
1 changed files with 1 additions and 0 deletions

View File

@ -4,6 +4,7 @@
{% set hosts = {} -%}
{% for host, vars in hostvars.items() -%}
{% set _ = hosts.update({host: vars['nodepool']['private_ipv4']}) -%}
{% set _ = hosts.update({vars['ansible_hostname']: vars['nodepool']['private_ipv4']}) -%}
{% endfor -%}
{{- hosts -}}