I need to create a Jira ticket using rest API. Is there a way to pass in a date variable to a custom due date field?
"customfield_10111": { "value": "{{ cr_due_date }}" }, doesn't seem to work.
tasks:
- name: Ansible date fact example
command: "date +'%m-%d-%Y' -d '+3 days'"
register: result
- set_fact:
cr_due_date: "{{ result.stdout }}"
- name: create pre-approved CR uri: url: "{{ jira_cr_request_api_url }}" method: POST headers: Content-Type: "application/json" body: "{{ lookup('file','test_jira.json') }}" body_format: json user: "{{ jira_username }}" password: "{{ jira_password }}" validate_certs: no return_content: yes force_basic_auth: yes status_code: 201 follow_redirects: false register: jira_issue
{ "fields": { "project": { "key": "CR" }, "summary": "testing jira ticket automation", "description": "Creating of an issue using project keys and issue type names using the REST API", "issuetype": { "id": "10301" }, "customfield_13300": [{"value" : "AWS"}], "customfield_10111": { "value": "{{ cr_due_date }}" }, "customfield_13303": { "value": "Ops" }, "customfield_13901": {"value": "OPS" , "child": {"id": "13308"}} }}