On 09/08/2021 15:10, Mahesh Nalavade wrote:
> Hi ,
>
> While running the ansible task in azure pipeline we are getting the below warning message. Please let us know if we can ignore/suppress the warning.
>
> [WARNING]: conditional statements should not include jinja2 templating
> delimiters such as {{ }} or {% %}. Found: {% for item in hostvars.values() %}{%
> if item.MyDoneVar|default(False) %}True{% endif %}{% endfor %}
The logic behind your condition eludes me, but the expression for conditions are always subject to templating. This means you can't use {{, {% if, {% for etc.
You can start to convert your logic to
hostvar.values | dict2items | ... | count
Regards
Racke
>
> ==========================================================
> Playbook:-
> =============
> ---
> - name: Check the status of DSE layer 7 cluster
> hosts: XXXX
> gather_facts: False
> serial: 1
> tasks:
> - meta: end_play
> when: "{% for item in hostvars.values() %}{% if item.MyDoneVar|default(False) %}True{% endif %}{% endfor %}"
> - name: nodetool status playbook execution
> import_role:
> name: ../roles/dse/nodetool_status_check
>
> Role:-
> =========
> ---
> - name: Nodetool status for DSE layer 7 cluster
> block:
> - name: Nodetool Status
> shell: nodetool -u controlRole -pw '{{ controlRole_dse_layer7_pass }}' status | grep -A 10 {{ dse_layer_7_datacenter_name }}
> register: result_nodetool
> - set_fact:
> MyDoneVar: True
>
> --
> 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-proje...@googlegroups.com <mailto:
ansible-proje...@googlegroups.com>.
> To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/c7db9905-75f3-452e-88a3-3ca2b95b3836n%40googlegroups.com <
https://groups.google.com/d/msgid/ansible-project/c7db9905-75f3-452e-88a3-3ca2b95b3836n%40googlegroups.com?utm_medium=email&utm_source=footer>.
--
Ecommerce and Linux consulting + Perl and web application programming.
Debian and Sympa administration.