Ansible - Make a date human readable using the strftime filter
by
Jeremy Canfield |
Updated: March 02 2022
| Ansible articles
The strftime filter is used to convert a date format string into a human readable date. Or, the ansible_date_time is a magic can be used. Or, the lookup plugin can be used.
In this example, %Y-%m-%d is converted.
- name: "format date using the strftime filter"
debug:
msg: "{{ '%Y-%m-%d' | strftime }}"
Something like this should be returned.
TASK [format date using the strftime filter]
ok: [server1.example.com] => {
"msg": [
"2020-12-05"
]
}
Did you find this article helpful?
If so, consider buying me a coffee over at