Ansible dict date to csv file

IF you have your closters has dicts in your variable you can use a loop with dict2items and loop around it, as to writing it in your file you can use this module

https://docs.ansible.com/ansible/latest/collections/ansible/builtin/lineinfile_module.html

IF you have your closters has dicts in your variable you can use a loop with dict2items and loop around it, as to writing it in your file you can use this module
https://docs.ansible.com/ansible/latest/collections/ansible/builtin/lineinfile_module.html

Using lineinfile doesn't make sense when your write the whole file. In this case the template module is the better choice.

Regards

          Racke