---
- hosts: localhost
tasks:
- debug:
var: hostvars['localhost']['ansible_date_time']['iso8601']
ok: [localhost] => {
"hostvars['localhost']['ansible_date_time']['iso8601']":
"2022-07-22T10:28:46Z"
However:
---
- hosts: localhost
tasks:
- debug:
var: hostvars['localhost']['ansible_date_time']['iso8601']
register: date_time
- debug:
msg: "{{ ( (date_time).total_seconds() / 3600 ) | int }}"
does not work.
This is because the difference in variable:
"2022-07-22T10:28:46Z" must be 2022-07-22T10:28:46Z without quotes.
How can I do that?
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/aa5b4d61-d541-4d15-8c33-96c8aa0bb794n%40googlegroups.com.