delegate_to works incorrectly with with_items

Hello!

I have an issue: delegate_to works incorrectly with with_items. I cannot collect missing facts. I’ve opened an issue but it was already closed. Is there anything wrong with my playbook?

Thank you,
Yours Faithfully,
Roman Belyakovsky

Hi,

It seems setup module with delegate_to doesn’t work as intended in Ansible prior to 2.0. It actually updates facts of self (hostvars[inventory_hostname]) with facts of delegated host. Ansible 2.0 successfully updates delegated host’s hostvars. Confirmed with the following playbook:

`

Until 2.0 getting facts was always updating the 'delegated for' host,
in 2.0 we changed it so it updates the 'delegated to' host.

Before 2.0 the only way to get facts for machines not in your play was
to gather them in a previous play and either run that play at the same
time as the play that used them or use persistent fact caching to make
them available.