fix: avoid failure with jinja2_native=true

If you run the role on an ansible configured with that setting, it will fail with:

    fatal: [vm0]: FAILED! => {"msg": "Unexpected templating type error occurred on ({% for host in ansible_play_hosts_all %}\n{% filter string %}\n{% filter replace('\\n', ' ') %}\n{{ host }}\n@@@\n{{ hostvars[host].ansible_host | default(hostvars[host].ansible_fqdn) }}\n@@@\nC_{{ hostvars[host].k3s_control_node }}\n@@@\nP_{{ hostvars[host].k3s_primary_control_node | default(False) }}\n{% endfilter %}\n{% endfilter %}\n@@@ END:{{ host }}\n{% endfor %}): sequence item 4: expected str instance, bool found"}
This commit is contained in:
Yajo 2021-07-19 09:26:57 +00:00
parent 0c084531d2
commit 05e62b6344

View file

@ -69,11 +69,11 @@
{% filter replace('\n', ' ') %}
{{ host }}
@@@
{{ hostvars[host].ansible_host | default(hostvars[host].ansible_fqdn) }}
{{ hostvars[host].ansible_host | default(hostvars[host].ansible_fqdn) | string }}
@@@
C_{{ hostvars[host].k3s_control_node }}
C_{{ hostvars[host].k3s_control_node | string }}
@@@
P_{{ hostvars[host].k3s_primary_control_node | default(False) }}
P_{{ hostvars[host].k3s_primary_control_node | default(False) | string }}
{% endfilter %}
@@@ END:{{ host }}
{% endfor %}