Why sometimes result of tasks looping over with_items entries are printed in one line and sometimes in multiple lines

For example:

`
TASK [hal9000 : Install packages] ********************
ok: [localhost] => (item=[u’python-lxml’, u’jdk1.8.0_92’])

TASK [hal9000 : Copy configurations] *****************
ok: [localhost] => (item=a)
ok: [localhost] => (item=b)
ok: [localhost] => (item=c)
ok: [localhost] => (item=d)
`

The only difference is that for the first task, the items are static values but for the second task they are stored in a variable.

But why is Ansible treating them different?

depends on how you define the loop, I cannot tell you more w/o you
showing the actual tasks.