Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions playbooks/restart-nginx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
servicenow.itsm.incident:
state: new
description: " Dynatrace reported {{ problemID }}"
short_description: "Nginx is down per {{ problemID }} on {{ reporting_host }} reported by Dynatrace nginix monitor."
short_description: Nginx is down per {{ problemID }} on {{ reporting_host }} reported by Dynatrace nginix monitor.
caller: admin
urgency: "{{ sn_urgency }}"
impact: "{{ sn_impact }}"
Expand All @@ -27,10 +27,10 @@
ansible.builtin.set_fact:
ticket_number: "{{ new_incident.record.number }}"

- name: Check what state the service was in
- name: Check what state the service was in
ansible.builtin.service_facts:

- name: Print out Service states
- name: Print out Service states
ansible.builtin.debug:
var: ansible_facts.services['nginx.service']

Expand All @@ -39,10 +39,10 @@
state: in_progress
number: "{{ ticket_number }}"
other:
comments: "Ansible automation is working on {{ problemID }}. on host {{ reporting_host }}.\n Service was in {{ ansible_facts.services['nginx.service']['state'] }} state and {{ ansible_facts.services['nginx.service']['status'] }} status"
comments: "Ansible automation is working on {{ problemID }}. on host {{ reporting_host }}.\n Service was in {{ ansible_facts.services['nginx.service']['state']
}} state and {{ ansible_facts.services['nginx.service']['status'] }} status"
delegate_to: localhost


- name: Try to restart nginx
ansible.builtin.service:
name: nginx
Expand All @@ -54,7 +54,7 @@
state: in_progress
number: "{{ ticket_number }}"
other:
comments: "Ansible automation is working on {{ problemID }}. on host {{ reporting_host }}"
comments: Ansible automation is working on {{ problemID }}. on host {{ reporting_host }}
delegate_to: localhost

- name: Validate service is up and update/close SNOW ticket
Expand All @@ -63,12 +63,11 @@
servicenow.itsm.incident:
state: closed
number: "{{ ticket_number }}"
close_code: "Solved (Permanently)"
close_notes: "Go back to bed. Ansible fixed problem {{ problemID }} on host {{ reporting_host }} reported by Dynatrace."
close_code: Solved (Permanently)
close_notes: Go back to bed. Ansible fixed problem {{ problemID }} on host {{ reporting_host }} reported by Dynatrace.
delegate_to: localhost

- name: Print chksrvc
ansible.builtin.debug:
msg: "Hey your nginix web server is back up. Good for you"
msg: Hey your nginix web server is back up. Good for you
when: chksrvc.state == "started"

5 changes: 2 additions & 3 deletions playbooks/simplenginx.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
- name: Restore nginx
- name: Restore nginx
hosts: "{{ reporting_host }}"
gather_facts: false
become: true
Expand All @@ -16,6 +16,5 @@

- name: Print chksrvc
ansible.builtin.debug:
msg: "Hey your nginix web server is back up. Good for you"
msg: Hey your nginix web server is back up. Good for you
when: chksrvc.state == "started"

2 changes: 1 addition & 1 deletion rulebooks/dynatrace.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
action:
run_job_template:
name: Fix Nginx and update all
organization: "Default"
organization: Default
job_args:
extra_vars:
problemID: "{{ event.displayId }}"
Expand Down