Hello everyone.
Block scalars are described here.
The goal is to be improve the readability of the following block scalar example and obtain the intended value for the variable:
- set_fact:
variable: "{% if condition_1 is true %}{% if condition_2 is true %}'value'{% else %}'another value'{% endif %}{% else %}{{ another_variable }}{% endif %}"
I unsuccessfully tried:
- set_fact:
variable: >-
"{% if condition_1 is true %}
{% if condition_2 is true %}
'value'
{% else %}
'another value'
{% endif %}
{% else %}
{{ another_variable }}
{% endif %}"
Unfortunately, some spaces are added in the variable set value and there does not seem to be a way to completely “prune” them.
Am I missing something?