Ansible - Make a date human readable using the strftime filter

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"
    ]
}

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.





Please enter bf964 in the box below so that we can be sure you are a human.




Comments

Web design by yours truely - me, myself, and I   |   jeremy.canfield@freekb.net   |