# iterator_conditional.yml
---
- name: test iteratory with when
hosts: all
tasks:
- command: echo {{ item }}
with_items: [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]
when: item > 7
$ ansible-playbook -i 'localhost,' -c local iterator_conditional.yml