-
Notifications
You must be signed in to change notification settings - Fork 24.1k
Closed
Labels
affects_2.0This issue/PR affects Ansible v2.0This issue/PR affects Ansible v2.0c:playbook/blockc:playbook/loop_controlfeatureThis issue/PR relates to a feature request.This issue/PR relates to a feature request.support:coreThis issue/PR relates to code supported by the Ansible Engineering Team.This issue/PR relates to code supported by the Ansible Engineering Team.
Description
Issue Type:
Feature Idea
Component Name:
blocks
Ansible Version:
Ansible 2.0.0_rc-1
Ansible Configuration:
NA
Environment:
Ubuntu 15.10
Summary of Decision:
We're open to implementing this but want it to go through the proposal process. Please see: #13262 (comment) for details.
Summary:
There are a number of use-cases where it would be valuable to be able to loop over a block of tasks, such that a few tasks are done in order, and that specific block of tasks are looped over for some set of values. It seems that the new block functionality could lend itself well to this if you were to enable looping over blocks.
Steps To Reproduce:
- hosts: localhost
connection: local
tasks:
- block:
- debug: msg="task 1 loop {{item}}"
- debug: msg="task 2 loop {{item}}"
with_items:
- "1"
- "2"Expected Results:
PLAY ***************************************************************************
TASK [setup] *******************************************************************
ok: [localhost]
TASK [debug msg=task 1 loop {{item}}] ******************************************
ok: [localhost] => {
"changed": false,
"msg": "task 1 loop 1"
}
TASK [debug msg=task 2 loop {{item}}] ******************************************
ok: [localhost] => {
"changed": false,
"msg": "task 2 loop 1"
}
TASK [debug msg=task 1 loop {{item}}] ******************************************
ok: [localhost] => {
"changed": false,
"msg": "task 1 loop 2"
}
TASK [debug msg=task 2 loop {{item}}] ******************************************
ok: [localhost] => {
"changed": false,
"msg": "task 2 loop 2"
}
PLAY RECAP *********************************************************************
localhost : ok=5 changed=0 unreachable=0 failed=0
Actual Results:
ERROR! 'with_items' is not a valid attribute for a Block
The error appears to have been in '/root/test.yml': line 5, column 5, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
tasks:
- block:
^ here
srgvg, soar, jgrowl, ttomttom, melentye and 345 moreCOLABORATI, escoreal, dreamcat4, rqelibari, frenck and 16 moreCOLABORATI, TaiSHiNet, satoryu, escoreal, Fale and 32 more
Metadata
Metadata
Assignees
Labels
affects_2.0This issue/PR affects Ansible v2.0This issue/PR affects Ansible v2.0c:playbook/blockc:playbook/loop_controlfeatureThis issue/PR relates to a feature request.This issue/PR relates to a feature request.support:coreThis issue/PR relates to code supported by the Ansible Engineering Team.This issue/PR relates to code supported by the Ansible Engineering Team.