Ansible Template help

I need help to create a template that echos a sql query to a .sql file .

Hi @tharun232 , why do you need a template for this task? If your needs are to create a .sql file with some content, why don’t you use the ansible.builtin.blockinfile module as seen here.

Vitor Jr.
KodeKloud Support

You can use also as mentionned the blockinfile module as you can use jinja template and past your content inside.
Once completed you can use template module to copy that one to your destination.

Hello @houariabdelmouhssine,
Thanks for sharing!