# AWX extra\_var for datetimes exhibiting different behavior between Ansible 2.18 and 2.19

**URL:** <https://forum.ansible.com/t/awx-extra-var-for-datetimes-exhibiting-different-behavior-between-ansible-2-18-and-2-19/44466>\
**Category:** Get Help\
**Tags:** ansible, ansible-project, awx, 219, ee\
**Created:** [September 11, 2025, 1:45pm UTC](https://forum.ansible.com/t/awx-extra-var-for-datetimes-exhibiting-different-behavior-between-ansible-2-18-and-2-19/44466 "2025-09-11T13:45:41Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon81884396](https://avatars.discourse-cdn.com/v4/letter/a/b782af/32.png) [@anon81884396](https://forum.ansible.com/u/anon81884396)\
**Post date:** [September 11, 2025, 1:45pm UTC](https://forum.ansible.com/t/awx-extra-var-for-datetimes-exhibiting-different-behavior-between-ansible-2-18-and-2-19/44466/1 "2025-09-11T13:45:41Z")

</div>

I’ve been making my way through converting my playbooks from 2.18 to 2.19 and I’ve noticed odd (to me) behavior when supplying extra\_vars via a job template in AWX between the two.

Here’s the playbook:

```auto
---
- name: Show fact
  hosts: localhost
  gather_facts: false
  become: false
  connection: local
  tasks:
    - name: Show fact
      ansible.builtin.debug:
        msg: "date_fact is {{ date_fact }}"

```

I supply an extra\_var via AWX for date\_fact of `"date_fact": "2025-09-11T12:29:45.000000+00:00"`

The results of the playbook run for the 2.18 execution environment are:

```auto
PLAY [Show fact] ***************************************************************

TASK [Show fact] ***************************************************************

ok: [localhost] => {
    "msg": "date_fact is 2025-09-11T12:29:45.000000+00:00"
}

PLAY RECAP *********************************************************************
localhost : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0  

```

For the 2.19 execution environment it is:

```auto
PLAY [Show fact] ***************************************************************

TASK [Show fact] ***************************************************************

ok: [localhost] => {
    "msg": "date_fact is 2025-09-11 12:29:45+00:00"
}

PLAY RECAP *********************************************************************

localhost : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0  

```

I can’t seem to replicate this behavior running ansible-playbook using 2.19 locally, it seems to only happen in the AWX template with the 2.19 EE.

So, in short, `2025-09-11T12:29:45.000000+00:00` shows as `2025-09-11T12:29:45.000000+00:00` for Ansible 2.18 EE via an AWX template extra\_var. However, `2025-09-11T12:29:45.000000+00:00` turns to `2025-09-11 12:29:45+00:00` for Ansible 2.19 EE via an AWX template extra\_var.

My use-case is that I have other jobs that trigger this job and they send a datetime stamp as an extra\_var for it to send to an external API endpoint so the source jobs don’t need to wait/care about this reporting process.

I was able to get it to work with a strftime conversion in my original job, but I’m curious at the root cause of this as it may affect other playbooks in different ways. I didn’t see anything in [Ansible-core 2.19 Porting Guide — Ansible Community Documentation](https://docs.ansible.com/ansible/latest/porting_guides/porting_guide_core_2.19.html) pardon me if I missed it.

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [September 11, 2025, 2:31pm UTC](https://forum.ansible.com/t/awx-extra-var-for-datetimes-exhibiting-different-behavior-between-ansible-2-18-and-2-19/44466/2 "2025-09-11T14:31:18Z")

</div>

I don’t have an exact answer for you, as I also cannot replicate this behavior exactly. But I can probably give you enough information about the changes made in 2.19 that would help this make sense.

1. AWX writes out the extra vars file in YAML format for consumption by ansible-playbook

2. YAML has a `timestamp` type, and your ISO8601 formatted string matches the regex used by YAML to parse it into this `timestamp` format. What this means for python, is that pyyaml converts it to the native datetime format using the `datetime` module:

3. The process of switching over the the jinja2 native environment fully, means that we carry the exact types through the jinja templating process much better than before

4. The default behavior of stringifying a `datetime.datetime` object is to format it like ISO8601 but explicitly using a space as the separator character instead of `T`

Something in the past must have caused it be serialized back to an explicit string in iso8601 format during the process in the past, or otherwise it was somehow never consumed as a YAML  
timestamp for some reason that I cannot guess at currently.

---

<div class="post-metadata">

**Author:** ![anon81884396](https://avatars.discourse-cdn.com/v4/letter/a/b782af/32.png) [@anon81884396](https://forum.ansible.com/u/anon81884396)\
**Post date:** [September 11, 2025, 2:33pm UTC](https://forum.ansible.com/t/awx-extra-var-for-datetimes-exhibiting-different-behavior-between-ansible-2-18-and-2-19/44466/3 "2025-09-11T14:33:14Z")

</div>

Interesting, thank you!

---

<div class="post-metadata">

**Author:** ![utoddl](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/utoddl/32/249_2.png) [@utoddl](https://forum.ansible.com/u/utoddl)\
**Post date:** [September 11, 2025, 3:31pm UTC](https://forum.ansible.com/t/awx-extra-var-for-datetimes-exhibiting-different-behavior-between-ansible-2-18-and-2-19/44466/4 "2025-09-11T15:31:03Z")

</div>

> [@sivel](#):
>
> `.000000`

I didn’t notice the "`T` vs. ` `" delimiter change. I focused on “`.000000`” getting stripped off the seconds.

Probably whatever change caused the one also caused the other. [sigh]

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [October 11, 2025, 3:32pm UTC](https://forum.ansible.com/t/awx-extra-var-for-datetimes-exhibiting-different-behavior-between-ansible-2-18-and-2-19/44466/5 "2025-10-11T15:32:00Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
