ansible_stdout_compact_logger icon indicating copy to clipboard operation
ansible_stdout_compact_logger copied to clipboard

Debug message does not display when in a loop

Open marc-ledent opened this issue 6 years ago • 6 comments

The "debug" module does not display anything when in a loop. Example:

- hosts: all
  gather_facts: False
  tasks:
    - name: message loop
      debug:
        msg: "Hello {{item}}"
      with_items:
        - alice
        - bob

displays:

[16:20:18] message loop | some_host | SUCCESS | 45ms
{                                                 
  - msg: All items completed                      
}                                                 

marc-ledent avatar Nov 29 '18 15:11 marc-ledent

We should see something like this:

ok: [localhost] => (item=alice) => {
    "msg": "Hello alice"
}
ok: [localhost] => (item=bob) => {
    "msg": "Hello bob"
}
ok: [127.0.0.1] => (item=alice) => {
    "msg": "Hello alice"
}
ok: [127.0.0.1] => (item=bob) => {
    "msg": "Hello bob"
}

octplane avatar Dec 18 '18 12:12 octplane

Yes, but we don't...

marc-ledent avatar Dec 19 '18 09:12 marc-ledent

I need this as well.

selurvedu avatar Dec 04 '19 13:12 selurvedu

Could you try the content of branch octplane/debug-loop-display?

octplane avatar Dec 11 '19 09:12 octplane

Hi, I've same problem. I've tried with content of branch octplane/debug-loop-display without success.

(tested on ansible 2.9.2)

matthgyver avatar Feb 13 '20 16:02 matthgyver

Hi, I've the same problem. ansible 2.9.6 python version = 3.8.2 (default, Jul 16 2020, 14:00:26) [GCC 9.3.0]

prostir avatar Sep 17 '20 08:09 prostir

Hello people,

I have pushed a fix:

  • You can either call ansible-playbook with -vv
  • Or add dump_loop_items = True to ansible.cfg

The playbook test-18.yml is a test-case

image

octplane avatar Mar 07 '23 20:03 octplane

Just in time 😃 Thank you!

selurvedu avatar Mar 08 '23 11:03 selurvedu