Update Sharepoint.yaml
This commit is contained in:
@@ -43,6 +43,49 @@
|
|||||||
no_log: true
|
no_log: true
|
||||||
failed_when: graph_token.status not in [200]
|
failed_when: graph_token.status not in [200]
|
||||||
|
|
||||||
|
# --- Get recap from AWX and turn it into flat totals ---
|
||||||
|
- name: Fetch play recap (playbook_on_stats)
|
||||||
|
delegate_to: localhost
|
||||||
|
run_once: true
|
||||||
|
uri:
|
||||||
|
url: "{{ lookup('env','AWX_API_URL') }}/api/v2/jobs/{{ tower_job_id }}/job_events/?event=playbook_on_stats"
|
||||||
|
method: GET
|
||||||
|
headers:
|
||||||
|
Authorization: "Bearer {{ lookup('env','AWX_API_TOKEN') }}"
|
||||||
|
Content-Type: "application/json"
|
||||||
|
return_content: true
|
||||||
|
status_code: 200
|
||||||
|
register: _recap
|
||||||
|
no_log: true
|
||||||
|
|
||||||
|
- name: Parse recap totals
|
||||||
|
run_once: true
|
||||||
|
vars:
|
||||||
|
stats: "{{ (_recap.json.results | default([])) | first | default({}) }}"
|
||||||
|
data: "{{ stats.event_data | default({}) }}"
|
||||||
|
# event_data keys are dicts {host: count}; sum values safely
|
||||||
|
sumdict: >-
|
||||||
|
{% set ns = namespace(t=0) -%}
|
||||||
|
{%- for v in (item | default({})).values() -%}{%- set ns.t = ns.t + (v|int) -%}{%- endfor -%}
|
||||||
|
{{ ns.t }}
|
||||||
|
set_fact:
|
||||||
|
recap_ok: "{{ sumdict | from_yaml(item=data.ok) }}"
|
||||||
|
recap_changed: "{{ sumdict | from_yaml(item=data.changed) }}"
|
||||||
|
recap_failed: "{{ sumdict | from_yaml(item=data.failures) }}"
|
||||||
|
recap_skipped: "{{ sumdict | from_yaml(item=data.skipped) }}"
|
||||||
|
recap_unreach: "{{ sumdict | from_yaml(item=data.dark) }}"
|
||||||
|
vars_prompt: [] # no prompts; just here to keep YAML tidy
|
||||||
|
|
||||||
|
- name: Build SharePoint recap line
|
||||||
|
run_once: true
|
||||||
|
set_fact:
|
||||||
|
recap_line: >-
|
||||||
|
OK={{ recap_ok | default(0) }},
|
||||||
|
Changed={{ recap_changed | default(0) }},
|
||||||
|
Failed={{ recap_failed | default(0) }},
|
||||||
|
Skipped={{ recap_skipped | default(0) }},
|
||||||
|
Unreachable={{ recap_unreach | default(0) }}
|
||||||
|
|
||||||
- name: Verify siteId resolves
|
- name: Verify siteId resolves
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
run_once: true
|
run_once: true
|
||||||
@@ -116,7 +159,9 @@
|
|||||||
Status: "{{ status }}"
|
Status: "{{ status }}"
|
||||||
RunStart: "{{ run_start }}"
|
RunStart: "{{ run_start }}"
|
||||||
RunEnd: "{{ run_end }}"
|
RunEnd: "{{ run_end }}"
|
||||||
Notes: "{{ summary_text }}"
|
Notes: |-
|
||||||
|
{{ summary_text }}
|
||||||
|
Recap: {{ recap_line }}
|
||||||
register: sp_create
|
register: sp_create
|
||||||
no_log: false
|
no_log: false
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user