From 13b96b4bc6afd7b0e9b01e37ec581508fcdd2c33 Mon Sep 17 00:00:00 2001 From: Andrea Frittoli Date: Tue, 5 Jun 2018 10:23:01 +0100 Subject: [PATCH] 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 --- roles/multi-node-hosts-file/tasks/main.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/multi-node-hosts-file/tasks/main.yaml b/roles/multi-node-hosts-file/tasks/main.yaml index dc05a9537..a54bc5f21 100644 --- a/roles/multi-node-hosts-file/tasks/main.yaml +++ b/roles/multi-node-hosts-file/tasks/main.yaml @@ -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 -}}