Skip to content

Instantly share code, notes, and snippets.

@eclecticmiraclecat
Last active February 16, 2021 16:52
Show Gist options
  • Save eclecticmiraclecat/fe803e97ecfac0f4482b9743726f9f84 to your computer and use it in GitHub Desktop.
Save eclecticmiraclecat/fe803e97ecfac0f4482b9743726f9f84 to your computer and use it in GitHub Desktop.
# 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment