On Fri, 7 Jul 2023 12:30:08 -0400
Brian Coca <
bc...@redhat.com> wrote:
> > (The condition is evaluated on the remote host).
> No, conditions (as well as any templating) is always evaluated on the
> controller, the caveat is that DATA for this evaluation might come
> from the remote host. via `register:`.
Right. The *task_executor* takes care of this
https://github.com/ansible/ansible/blob/devel/lib/ansible/executor/task_executor.py#L775
I was too quick. The registered variable can be used in the label. If
the status of the task (changed) is available when the label is
displayed the registered variable should be available as well. For
example,
- command: "echo {{ item }}"
register: status
loop: [1, 2, 3, 4, 5]
loop_control:
label: "{{ status.stdout|int + 10 }}"
until: status.stdout|int < 4
delay: 1
gives
TASK [command]
***************************************************************
changed: [test_11] => (item=11)
changed: [test_11] => (item=12)
changed: [test_11] => (item=13)
FAILED - RETRYING: [test_11]: command (3 retries left).
FAILED - RETRYING: [test_11]: command (2 retries left).
FAILED - RETRYING: [test_11]: command (1 retries left).
failed: [test_11] (item=14) => changed=true
ansible_loop_var: item
attempts: 3
cmd:
- echo
- '4'
delta: '0:00:00.015013'
end: '2023-07-07 21:06:24.412645'
item: 4
msg: ''
rc: 0
start: '2023-07-07 21:06:24.397632'
stderr: ''
stderr_lines: <omitted>
stdout: '4'
stdout_lines: <omitted>
FAILED - RETRYING: [test_11]: command (3 retries left).
FAILED - RETRYING: [test_11]: command (2 retries left).
FAILED - RETRYING: [test_11]: command (1 retries left).
failed: [test_11] (item=15) => changed=true
ansible_loop_var: item
attempts: 3
cmd:
- echo
- '5'
delta: '0:00:00.015014'
end: '2023-07-07 21:06:33.054414'
item: 5
msg: ''
rc: 0
start: '2023-07-07 21:06:33.039400'
stderr: ''
stderr_lines: <omitted>
stdout: '5'
stdout_lines: <omitted>
--
Vladimir Botka