Skip processing role_networks if not defined
If role_networks is not defined, the jinja parsing fails because NoneType is not iterable when doing a 'if value in none_type_var' Change-Id: Ie89e6f914f11ad337e79b7af89568fd1a74568d1 Closes-Bug: #1837644
This commit is contained in:
parent
f56915eae7
commit
d5dac71c82
|
@ -48,13 +48,15 @@
|
|||
set_fact:
|
||||
ssh_known_hosts_lines: |-
|
||||
{%- for host in groups['overcloud'] | intersect(play_hosts) %}
|
||||
[{{ ctlplane_ip }}]*,[{{ host }}.{{ cloud_domain }}]*,[{{ host }}]*{%- if enabled_networks | length > 0 %},{% endif %}
|
||||
[{{ ctlplane_ip }}]*,[{{ host }}.{{ cloud_domain }}]*,[{{ host }}]*
|
||||
{%- if enabled_networks | length > 0 and role_networks and role_networks | length > 0 %},
|
||||
{%- for network in enabled_networks %}
|
||||
{%- if network in role_networks %}
|
||||
[{{ hostvars[host][networks[network]['name'] ~ '_ip'] }}]*,[{{ host }}.{{ networks[network]['name'] }}]*,{% if 1 %}{% endif %}
|
||||
[{{ host }}.{{ networks[network]['name'] }}.{{ cloud_domain }}]*{% if not loop.last %},{% endif %}
|
||||
{%- endif -%}
|
||||
{%- endfor -%}
|
||||
{%- endif -%}
|
||||
{{ ' ssh-rsa ' ~ hostvars[host]['ansible_ssh_host_key_rsa_public'] }}
|
||||
{% endfor %}
|
||||
|
||||
|
|
Loading…
Reference in New Issue