diff --git a/playbooks/restart-nginx.yml b/playbooks/restart-nginx.yml index 46d09f6..a966096 100644 --- a/playbooks/restart-nginx.yml +++ b/playbooks/restart-nginx.yml @@ -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 }}" @@ -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'] @@ -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 @@ -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 @@ -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" - diff --git a/playbooks/simplenginx.yml b/playbooks/simplenginx.yml index 2a273ad..acff22d 100644 --- a/playbooks/simplenginx.yml +++ b/playbooks/simplenginx.yml @@ -1,5 +1,5 @@ --- -- name: Restore nginx +- name: Restore nginx hosts: "{{ reporting_host }}" gather_facts: false become: true @@ -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" - diff --git a/rulebooks/dynatrace.yml b/rulebooks/dynatrace.yml index 2f5566b..0c8055d 100644 --- a/rulebooks/dynatrace.yml +++ b/rulebooks/dynatrace.yml @@ -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 }}"