Generate the /etc/hosts content once.

This resolves a performance penalty of rendering many
hosts files for large deployments. Since they should
all match, we now generate the hosts block once and then
push it out to all of the nodes.

Change-Id: Iff6db6a520b9ff7fbb737a1ddb69c66cc2008ea7
Closes-Bug: #1860146
Signed-off-by: Luke Short <ekultails@gmail.com>
This commit is contained in:
Luke Short 2020-01-23 17:22:22 -05:00
parent fca9072421
commit dac34d302c
1 changed files with 13 additions and 6 deletions

View File

@ -27,12 +27,10 @@
tags:
- tripleo_hosts_entries
- name: Update /etc/hosts
become: true
blockinfile:
create: true
path: "{{ tripleo_hosts_entries_hosts_path }}"
block: |
- name: Render out the hosts entries
run_once: true
set_fact:
tripleo_hosts_entries_block: |
{{ tripleo_hosts_entries_undercloud_hosts_entries | join('') }}
{{ tripleo_hosts_entries_vip_hosts_entries | join('') }}
@ -55,3 +53,12 @@
{{ tripleo_hosts_entries_extra_hosts_entries | join('') }}
tags:
- tripleo_hosts_entries
- name: Update /etc/hosts
become: true
blockinfile:
create: true
path: "{{ tripleo_hosts_entries_hosts_path }}"
block: "{{ tripleo_hosts_entries_block }}"
tags:
- tripleo_hosts_entries