974b5d7dac
This allows nodes in a multi-node job to resolve each other through their inventory hostname. Change-Id: I19cc7690d6fea99461bc67a46a09a8037f9c3292
18 lines
493 B
YAML
18 lines
493 B
YAML
- name: Set up the list of hosts and addresses
|
|
set_fact:
|
|
host_addresses: >
|
|
{% set hosts = {} -%}
|
|
{% for host, vars in hostvars.items() -%}
|
|
{% set _ = hosts.update({host: vars['nodepool']['private_ipv4']}) -%}
|
|
{% endfor -%}
|
|
{{- hosts -}}
|
|
|
|
- name: Add inventory hostnames to the hosts file
|
|
become: yes
|
|
lineinfile:
|
|
dest: /etc/hosts
|
|
state: present
|
|
insertafter: EOF
|
|
line: "{{ item.value }} {{ item.key }}"
|
|
with_dict: "{{ host_addresses }}"
|