This issue was closed yesterday, but it’s still unresolved. set() type is still treated as a string in Ansible. While an error isn’t thrown when using a set in with_items, the entire set is treated as a single item, i.e. a string. This behavior isn’t any better than throwing an error. The issue should be re-opened.
Link: https://github.com/ansible/ansible/issues/10098
Thanks