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>
changes/70/704070/4
Luke Short 3 years ago
parent fca9072421
commit dac34d302c
  1. 19
      tripleo_ansible/roles/tripleo_hosts_entries/tasks/main.yml

@ -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

Loading…
Cancel
Save