Add AO for high CPU investigation
This commit is contained in:
@@ -15,6 +15,10 @@
|
|||||||
register: processes_mem
|
register: processes_mem
|
||||||
changed_when: false
|
changed_when: false
|
||||||
|
|
||||||
|
- name: Set var
|
||||||
|
ansible.builtin.set_fact:
|
||||||
|
event_payload: {{ processes_cpu + processes_mem }}
|
||||||
|
|
||||||
- name: Open Incident
|
- name: Open Incident
|
||||||
hosts: all
|
hosts: all
|
||||||
tasks:
|
tasks:
|
||||||
@@ -37,6 +41,40 @@
|
|||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
register: incident_result
|
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
|
# - name: Create SNow Problem
|
||||||
# servicenow.itsm.problem:
|
# servicenow.itsm.problem:
|
||||||
# instance: '{{ snow_instance }}'
|
# instance: '{{ snow_instance }}'
|
||||||
|
|||||||
Reference in New Issue
Block a user