mirror of https://github.com/ansible/ansible.git
Fix extended loop_control with includes (#61231)
* Fix extended loop_control with includes
* Use assert for testing extended loop_control
* fix typo
(cherry picked from commit a213b9160c)
pull/61847/head
parent
59280a933e
commit
e7fcb37e6c
@ -0,0 +1,12 @@
|
||||
- name: loop_control/extended/include https://github.com/ansible/ansible/issues/61218
|
||||
hosts: localhost
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- name: loop on an include
|
||||
include_tasks: inner.yml
|
||||
loop:
|
||||
- first
|
||||
- second
|
||||
- third
|
||||
loop_control:
|
||||
extended: yes
|
||||
@ -0,0 +1,9 @@
|
||||
- name: assert ansible_loop variables in include_tasks
|
||||
assert:
|
||||
that:
|
||||
- ansible_loop.index == ansible_loop.index0 + 1
|
||||
- ansible_loop.revindex == ansible_loop.revindex0 + 1
|
||||
- ansible_loop.first == {{ ansible_loop.index == 1 }}
|
||||
- ansible_loop.last == {{ ansible_loop.index == ansible_loop.length }}
|
||||
- ansible_loop.length == 3
|
||||
- ansible_loop.allitems|join(',') == 'first,second,third'
|
||||
Loading…
Reference in New Issue