Here is my variable file

  layers:
    - name: APP
      things:
        - cactus
        - lotus
        - jasmine
        - rose


    - name: WAS
      things:
        - mango
        - apple



Below is my jinja template file:
{% for layer in layers %}
<table>
<tr>
<th> </th>
{% for item in layer.things %}

<th align="center">{{ item }}</th>

{% endfor %}
</tr>
</table>
{% endfor %}


My requirement is to put an if else condition where if any file err*txt is 
present under {{ item }} folder like below 

if `ls {{ playbook_dir }}/{{ item }}/err*.txt | head -1` returns true / 
records then the template evaluates to
<th align="center">{{ item }}</th>
else
<th align="left">{{ item }}</th>

How do i  put the if /else condition in the jinja template ?

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/09aeda5f-5e30-4b6c-b047-eda3c4c5de8b%40googlegroups.com.

Reply via email to