mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 21:32:49 +00:00
Add now() jinja2 global func for getting the date/time (#43792)
* Add now() jinja2 global func for getting the date/time * Docs and changelog * now isn't a lookup, it doesn't need disabled
This commit is contained in:
@@ -18,6 +18,24 @@ Please note that all templating happens on the Ansible controller before the tas
|
||||
playbooks_lookups
|
||||
playbooks_python_version
|
||||
|
||||
.. _templating_now:
|
||||
|
||||
Get the current time
|
||||
````````````````````
|
||||
|
||||
.. versionadded:: 2.8
|
||||
|
||||
The ``now()`` Jinja2 function, allows you to retrieve python datetime object or a string representation for the current time.
|
||||
|
||||
The ``now()`` function supports 2 arguments:
|
||||
|
||||
utc
|
||||
Specify ``True`` to get the current time in UTC. Defaults to ``False``
|
||||
|
||||
fmt
|
||||
Accepts a `strftime <https://docs.python.org/3/library/datetime.html#strftime-strptime-behavior>`_ string that will be used
|
||||
to return a formatted date time string
|
||||
|
||||
|
||||
.. seealso::
|
||||
|
||||
|
||||
Reference in New Issue
Block a user