'Error: "datetime' is not json serializable" in Ansible playbook
I am getting below error while passing below date format to Ansible Tower REST API in extra_vars with Ansible uri module in body section.
date_slot: '2022-04-04T13:42:00' - variable
- name: "add extra vars "
uri:
url: "{{ tower_gui_url }}/api/v2/workflow_job_templates/{{ workflow_id }}/"
method: PATCH
url_username: "{{ tower_gui_username }}"
url_password: "{{ tower_gui_password }}"
body_format: json
body: { "extra_vars": "---\ndate_slot: {{ date_slot }}" }
validate_certs: false
force_basic_auth: true
return_content: yes
status_code: 200
Getting below error
datetime' is not json serializable
any idea on error, how to resolved it?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
