On 18.06.2019 20:18, Ansar Sahit wrote:
> Another doubt,
> 
> I'm trying to use this "if else block" with "set" inside a variable jinja2
> file used in roles templating.
> 
> Cat varfile.yml.j2
> 
> ----
>          {% if c == 1 %}
>          {% set group = 'grp1' %}
>          {% elif c == 2 %}
>          {% set group == 'grp3' %}
>          {% else %}
>          {% group == 'grp4' %}
>          {% endif %}
> 
> Groupname : {{ group }}
> Var: "test"
> 
> This groupname should get populated in the variable file.
> 
> How can I achieve this?

You can't use set like this, that's why we have given you another way of doing 
this.

-- 
Kai Stian Olstad

-- 
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/b73cbf49-828c-f474-284e-2be63cd9500f%40olstad.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to