Rework how we push the content in the file
Since we allow to pass lists, we can't just use |join('').
In addition, using the multi-line support in YAML via the "|" creates
some issues when we want to use |join('\n'): it gets escaped, meaning we
end with a one-line content with some \n entries.
The present patch ensures that:
- generated content is still pushed in a fact to not lose time
- static content (lists) is properly treated and outputs correctly
Closes-Bug: #1868588
Change-Id: I7e520035f24503e59840b34e5b2d9e9966cd6ca4
(cherry picked from commit 75ed35c46a
)
This commit is contained in:
parent
9d5ef54e1b
commit
f15182e589
|
@ -31,11 +31,7 @@
|
|||
run_once: true
|
||||
set_fact:
|
||||
tripleo_hosts_entries_block: |
|
||||
{{ tripleo_hosts_entries_undercloud_hosts_entries | join('') }}
|
||||
|
||||
{{ tripleo_hosts_entries_vip_hosts_entries | join('') }}
|
||||
|
||||
{% for host in groups['overcloud'] %}
|
||||
{% for host in groups['overcloud'] -%}
|
||||
{{ hostvars[host][hostvars[host]['hostname_resolve_network'] ~ '_ip'] ~ ' ' ~
|
||||
host ~ '.' ~ cloud_domain ~ ' ' ~ host }}
|
||||
{# ## NOTE(hjensas): The Undercloud Minion has no networks, need to check for that here. -#}
|
||||
|
@ -50,10 +46,7 @@
|
|||
{% endif %}
|
||||
{{ hostvars[host]['ctlplane_ip'] ~ ' ' ~
|
||||
host ~ '.ctlplane' ~ '.' ~ cloud_domain ~ ' ' ~ host ~ '.ctlplane' }}
|
||||
|
||||
{% endfor %}
|
||||
|
||||
{{ tripleo_hosts_entries_extra_hosts_entries | join('') }}
|
||||
tags:
|
||||
- tripleo_hosts_entries
|
||||
|
||||
|
@ -64,6 +57,12 @@
|
|||
path: "{{ tripleo_hosts_entries_hosts_path }}"
|
||||
# BOF denotes the beginning of the file.
|
||||
insertbefore: BOF
|
||||
block: "{{ tripleo_hosts_entries_block }}"
|
||||
block: |
|
||||
{{ tripleo_hosts_entries_block }}
|
||||
{% for host in tripleo_hosts_entries_undercloud_hosts_entries | default([]) +
|
||||
tripleo_hosts_entries_vip_hosts_entries | default([]) +
|
||||
tripleo_hosts_entries_extra_hosts_entries | default([]) %}
|
||||
{{ host }}
|
||||
{% endfor %}
|
||||
tags:
|
||||
- tripleo_hosts_entries
|
||||
|
|
Loading…
Reference in New Issue