- name: "[TIME-FETCH] Daily Health Check"
hosts: localhost
gather_facts: true
tasks:
- name: "Debug Current Job ID -> tower_job_id"
ansible.builtin.debug:
msg: "{{ tower_job_id }}"
- name: "Provide Token Details Before Fetching Job Details[Required
Variable]"
ansible.builtin.set_fact:
token: "SHQ0ywkHOnQy2kvE0O28VGo"
- name: "Fetch Current Job Details To Get Job Start Time"
ansible.builtin.uri:
url: "https://{{ tower_host }}/api/v2/jobs/{{ tower_job_id }}"
method: GET
validate_certs: false
return_content: true
status_code:
- 201
- 200
headers:
Authorization: "Bearer {{ token }}"
Content-Type: "application/json"
register: job_details
- name: "Fetch Start Time(request_date) From job_details in ISO-806
Format"
ansible.builtin.set_fact:
fetched_date: "{{ job_details.json.started }}" #
2023-07-20T16:36:44.396234Z
- name: "Reformat Start Time(fetched_date) To Proper Date Format"
ansible.builtin.set_stats:
data:
job_started_date_kp_to_kyndryl: "{{
fetched_date.split('.')[0].split('T')[0].split('-') | join('_') + '_' +
fetched_date.split('.')[0].split('T')[1].split(':') | join('_') }}"
# 2023_07_20_16_36_44
On Monday, July 24, 2023 at 7:53:20 PM UTC+5:30 javed khan Siddque wrote:
> [image: MicrosoftTeams-image (5).png]
>
> On Monday, July 24, 2023 at 7:51:07 PM UTC+5:30 javed khan Siddque wrote:
>
>> Hi All
>>
>> Is there a way to get job running Start/Finish time from tower .
>>
>>
>>
--
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/e704675a-9005-4984-a88d-227bd6323f76n%40googlegroups.com.