How to print the present date when the Ansible Jinja2 Template is run?
My Jinja2 template is
Today date is date +%Y-%m-%d
When I run the task it is simply copy pasting the same line, but I want todays date to be printed in the destination file
A built-in way of getting a date into a Jinja template is to use the template_run_date
variable that's automatically available when using the template module.
For example a Jinja template file my.conf.j2
# My configuration file
# Updated on {{ template_run_date }}
Will render the date/time stamp of when the template was rendered.