**My playbook sample :**
- name: Memory check
debug: msg='{% if "{{ item }} percent" in HOST_MGMT4.stdout %} MEMORY CHECK {% else %} MEMORY OK {% endif %}'
register: result_memory
with_sequence: '60-100'
>*My playbook sample :*||||- name: Memory check debug: msg='{% if "{{ item }} percent" in HOST_MGMT4.stdout %} MEMORY CHECK {% else %} MEMORY OK
{% endif %}' register: result_memory with_sequence: '60-100'|
Why don't you simple use a regex filter to extract the value instead of this needless loop?
E.g regex_findall.
Regards
Racke