See
https://jinja.palletsprojects.com/en/master/templates/#whitespace-control

On Wed, Mar 17, 2021 at 1:56 PM jean-christophe manciot <
[email protected]> wrote:

> Hello everyone.
> Block scalars are described here <https://yaml-multiline.info/>.
>
> 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?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/1b2e9cf5-923a-4891-878f-7d364573e2aan%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/1b2e9cf5-923a-4891-878f-7d364573e2aan%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>


-- 
Matt Martz
@sivel
sivel.net

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAD8N0v8OVj%3D0Bs%2B4gT5Cacq4CaKYkW%2BCsS7oWqY_RpLfdjmxrw%40mail.gmail.com.

Reply via email to