File with variables (template)

If I have a file and the user wants to pass variables for this file (example: http.conf)

should I convert the file to http.conf.j2 ? when copied to the server it will be read as http.conf or http.conf.j2 ?
where should be the location of this file ? under template folder in ansible project ?

How can i convert my file to .j2 ?

Did you get any chance to read this template module doc? https://docs.ansible.com/ansible/latest/modules/template_module.html

Just read a very basic usage of template module: http://www.mydailytutorials.com/ansible-template-module-examples/

If I have a file and the user wants to pass variables for this file (example: http.conf)

should I convert the file to http.conf.j2 ? when copied to the server it will be read as http.conf or http.conf.j2 ?
where should be the location of this file ? under template folder in ansible project ?

How can i convert my file to .j2 ?

Here is example:

  • name: Install http configuration file
    template:
    src: /path/to/httpd.conf.j2
    dest: /etc/httpd/conf/httpd.conf

The template files will usually have the .j2 extension, which denotes the Jinja2 templating engine used. You can keep the .j2 file either under your role’s template directory or template directory under your playbook directory. You no need to do any conversion. During the playbook execution, the variables in .j2 file will be replaced with the relevant values as long as the variables are defined.