Ansible Template help

Hi,
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.

Regards,
Vitor Jr.
KodeKloud Support

Hello,
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.
Greetings.

Hello @houariabdelmouhssine,
Thanks for sharing!