Block is not a module, it is a Ansible keyword, - block can be used
anywere tasks go, not inside a task declaration as you have above.
It is designed to contain tasks and group keywords for them as well as
allow error handling, not sure what you are trying to do with it
inside a debug statement.
Thank brian for correcting me.
-
hosts: localhost
-
tasks:
-
name: checking the issue
shell: echo {{ item }} | grep -w name | wc -l
register: var1
with_file: -
test.txt
-
debug:
var: {{ item.stdout }}
when: item.stdout != 0
with_items: ā{{ var1.results }}ā
But Iām not able to get count value in var.