You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
ansible-role-nginx/language_features/loop_nested.yml

24 lines
555 B

---
# this is a trivial example of how to do a nested loop.
- hosts: all
tasks:
- shell: echo "nested test a={{ item[0] }} b={{ item[1] }} c={{ item[2] }}"
with_nested:
- [ 'red', 'blue', 'green' ]
- [ 1, 2, 3 ]
- [ 'up', 'down', 'strange']
# you can reference a raw variable name without putting it in {{ brackets }}
- hosts: all
vars:
listvar1:
- 'a'
- 'b'
- 'c'
tasks:
- shell: echo "nested test a={{ item[0] }} b={{ item[1] }}"
with_nested:
- listvar1
- [ 1, 2, 3 ]