Skip to content

Commit

Permalink
Merge pull request #1 from shadowman-lab/bot/ansible-lint/89077ac3730…
Browse files Browse the repository at this point in the history
…109c69a2d0b3a96e1a58051476446

Ansible code bot recommendations
  • Loading branch information
adworjan authored Dec 26, 2023
2 parents 89077ac + cc21dd2 commit 2744e04
Show file tree
Hide file tree
Showing 22 changed files with 41 additions and 24 deletions.
1 change: 1 addition & 0 deletions ServiceNowCR_and_approve.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
- name: Create and wait for approval of a change request
hosts: localhost
gather_facts: false
Expand Down
3 changes: 2 additions & 1 deletion ServiceNowCR_canceled.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
---
- name: Cancel a change request
hosts: localhost
gather_facts: false
connection: local

vars:
servicenow_cr: "canceled"
servicenow_cr: canceled

roles:
- servicenow_change_request
3 changes: 2 additions & 1 deletion ServiceNowCR_closed.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
---
- name: Close a change request
hosts: localhost
gather_facts: false
connection: local

vars:
servicenow_cr: "close"
servicenow_cr: close

roles:
- servicenow_change_request
3 changes: 2 additions & 1 deletion ServiceNowCR_create.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
---
- name: Create a change request
hosts: all
gather_facts: false
connection: local

vars:
servicenow_cr: "create"
servicenow_cr: create

roles:
- servicenow_change_request
3 changes: 2 additions & 1 deletion ServiceNowCR_deleted.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
---
- name: Delete a change request
hosts: localhost
gather_facts: false
connection: local

vars:
servicenow_cr: "absent"
servicenow_cr: absent

roles:
- servicenow_change_request
3 changes: 2 additions & 1 deletion ServiceNowCR_implement.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
---
- name: Implement a change request
hosts: localhost
gather_facts: false
connection: local

vars:
servicenow_cr: "implement"
servicenow_cr: implement

roles:
- servicenow_change_request
1 change: 1 addition & 0 deletions ServiceNowCatalog.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
- name: Update a catalog item in ServiceNow
hosts: localhost
gather_facts: false
Expand Down
1 change: 1 addition & 0 deletions ServiceNow_cmdb_update.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
- name: Update CMDB table
hosts: "{{ vm_name | default('all') }}"
gather_facts: false
Expand Down
3 changes: 2 additions & 1 deletion ServiceNowticket.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
---
- name: Create an incident in ServiceNow using facts from a host
hosts: "{{ vm_name | default('all')}}"
gather_facts: false
connection: local

vars:
servicenow_ticket: "create"
servicenow_ticket: create

roles:
- servicenow_ticket
3 changes: 2 additions & 1 deletion ServiceNowticket_close.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
---
- name: Close an incident in ServiceNow
hosts: all
gather_facts: false
connection: local

vars:
servicenow_ticket: "close"
servicenow_ticket: close

roles:
- servicenow_ticket
3 changes: 2 additions & 1 deletion ServiceNowticket_eda.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
---
- name: Create an incident in ServiceNow from EDA
hosts: "{{ vm_name | default('all')}}"
gather_facts: false
connection: local

vars:
servicenow_ticket: "createeda"
servicenow_ticket: createeda

roles:
- servicenow_ticket
3 changes: 2 additions & 1 deletion ServiceNowticket_find.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
---
- name: Find an incident in ServiceNow
hosts: localhost
gather_facts: false

vars:
servicenow_ticket: "find"
servicenow_ticket: find

roles:
- servicenow_ticket
3 changes: 2 additions & 1 deletion ServiceNowticket_inprogress.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
---
- name: Update an incident in ServiceNow
hosts: all
gather_facts: false
connection: local

vars:
servicenow_ticket: "update"
servicenow_ticket: update

roles:
- servicenow_ticket
5 changes: 3 additions & 2 deletions ServiceNowticket_security.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
---
- name: Create an incident in ServiceNow for IP Blocking
hosts: localhost
gather_facts: false
connection: local

vars:
incident_description: "AAP IP Block"
incident_description: AAP IP Block
sn_urgency: high
sn_impact: high
servicenow_ticket: "create"
servicenow_ticket: create

roles:
- servicenow_ticket
1 change: 1 addition & 0 deletions ServiceNowuser_create.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
- name: Create a servicenow admin user
hosts: localhost
gather_facts: false
Expand Down
2 changes: 1 addition & 1 deletion collections/requirements.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
collections:

- name: community.general

- name: servicenow.itsm
2 changes: 1 addition & 1 deletion roles/servicenow_change_request/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
---
servicenow_cr: "create"
servicenow_cr: create
to_email: "{{ to_emails.split(',') }}"
4 changes: 2 additions & 2 deletions roles/servicenow_change_request/tasks/servicenow_create.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
servicenow.itsm.change_request:
state: new
type: standard
template: "Reboot Windows Server - 1"
short_description: "Reboot Windows Server"
template: Reboot Windows Server - 1
short_description: Reboot Windows Server
requested_by: admin
other:
cmdb_ci: "{{ ip_addr }}"
Expand Down
12 changes: 7 additions & 5 deletions roles/servicenow_change_request_wait/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
servicenow.itsm.change_request:
type: normal
short_description: "{{ cr_description }}"
description: "{{ owner | default('Shadowman') }} requests {{ operating_system | default('') }} server in {{ shadowman_provision_hypervisor | default('') }} with name {{ vm_name | default('') }} and environment {{ env | default('test') }}"
description: "{{ owner | default('Shadowman') }} requests {{ operating_system | default('') }} server in {{ shadowman_provision_hypervisor | default('') }}
with name {{ vm_name | default('') }} and environment {{ env | default('test') }}"
priority: high
risk: moderate
impact: low
assignment_group: "CAB Approval"
assignment_group: CAB Approval
state: assess
register: request
until: request.changed is defined
Expand All @@ -31,8 +32,9 @@
username: "{{ EMAIL_USERNAME }}"
password: "{{ EMAIL_PASSWORD }}"
port: "{{ EMAIL_PORT }}"
subject: "Approval request for ServiceNow Change Request {{ request.record.number }}"
body: "You have a new CR Approval request. Please click on this URL to approve: {{ lookup('env', 'SN_HOST') }}nav_to.do?uri=change_request.do?sysparm_query=number={{ request.record.number }}"
subject: Approval request for ServiceNow Change Request {{ request.record.number }}
body: "You have a new CR Approval request. Please click on this URL to approve: {{ lookup('env', 'SN_HOST') }}nav_to.do?uri=change_request.do?sysparm_query=number={{
request.record.number }}"
from: tower@shadowman.dev
to: "{{ to_email }}"
delegate_to: localhost
Expand All @@ -50,5 +52,5 @@
servicenow.itsm.change_request:
state: implement
number: "{{ request.record.number }}"
assignment_group: "CAB Approval"
assignment_group: CAB Approval
delegate_to: localhost
2 changes: 1 addition & 1 deletion roles/servicenow_ticket/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
servicenow_ticket: "create"
servicenow_ticket: create
2 changes: 1 addition & 1 deletion roles/servicenow_ticket/tasks/servicenow_close.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
servicenow.itsm.incident:
state: closed
number: "{{ ticket_number }}"
close_code: "Solved (Permanently)"
close_code: Solved (Permanently)
close_notes: "{{ comment }}"
delegate_to: localhost
2 changes: 1 addition & 1 deletion roles/servicenow_ticket/tasks/servicenow_create_eda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@
- name: Pass incident number
ansible.builtin.set_stats:
data:
ticket_number: "{{ new_incident.record.number }}"
ticket_number: "{{ new_incident.record.number }}"

0 comments on commit 2744e04

Please sign in to comment.