From 0b5a1f7b96193dd91d0535b9666b6a4c4f390c46 Mon Sep 17 00:00:00 2001 From: Patrick Toal Date: Wed, 14 Oct 2026 12:12:50 -0600 Subject: [PATCH] Add AO for high CPU investigation --- playbooks/investigate_high_cpu.yml | 38 ++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/playbooks/investigate_high_cpu.yml b/playbooks/investigate_high_cpu.yml index c8f7080..647f03e 100644 --- a/playbooks/investigate_high_cpu.yml +++ b/playbooks/investigate_high_cpu.yml @@ -15,6 +15,10 @@ register: processes_mem changed_when: false + - name: Set var + ansible.builtin.set_fact: + event_payload: {{ processes_cpu + processes_mem }} + - name: Open Incident hosts: all tasks: @@ -37,6 +41,40 @@ delegate_to: localhost register: incident_result +- name: Trigger EDA webhook + hosts: all + connection: local + gather_facts: false + + tasks: + - name: Obtain OAuth token + ansible.builtin.uri: + url: "{{ webhook_base_url }}/api/v1/auth/token" + method: POST + body_format: form-urlencoded + body: + grant_type: client_credentials + client_id: "{{ webhook_client_id }}" + client_secret: "{{ webhook_client_secret }}" + status_code: 200 + register: token_response + + - name: Post event payload to Event-Driven Ansible trigger endpoint + ansible.builtin.uri: + url: "{{ webhook_base_url }}/api/v1/webhooks/eda/{{ webhook_path }}" + method: POST + body_format: json + headers: + Authorization: "Bearer {{ token_response.json.access_token }}" + Content-Type: application/json + body: "{{ event_payload }}" + status_code: 202 + register: webhook_response + + - name: Display execution ID + ansible.builtin.debug: + msg: "Workflow execution started: {{ webhook_response.json.execution_id }}" + # - name: Create SNow Problem # servicenow.itsm.problem: # instance: '{{ snow_instance }}'