Skip to content

Latest commit

 

History

History
763 lines (702 loc) · 36.7 KB

servicenow.itsm.problem_module.rst

File metadata and controls

763 lines (702 loc) · 36.7 KB

servicenow.itsm.problem module -- Manage ServiceNow problems

This module is part of the servicenow.itsm collection (version 2.7.0).

It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install servicenow.itsm.

To use it in a playbook, specify: servicenow.itsm.problem.

New in servicenow.itsm 1.0.0

Parameter

Comments

assigned_to

string

A person who will assess this problem.

Expected value for assigned_to is user id (usually in the form of first_name.last_name).

This field is required when creating new problems for all problem states except new.

attachments

list / elements=dictionary

added in servicenow.itsm 1.2.0

ServiceNow attachments.

name

string

Name of the file to be uploaded.

Serves as unique identifier.

If not specified, the module will use path's base name.

path

string / required

Path to the file to be uploaded.

type

string

MIME type of the file to be attached.

If not specified, the module will try to guess the file's type from its extension.

base_api_path

string

added in servicenow.itsm 2.0.0

Base API path for the ServiceNow problem state management scripted API.

Used for managing problem state transitions.

Requires API for Red Hat Ansible Automation Platform Certified Content Collection application to be installed from the ServiceNow Store https://store.servicenow.com/sn_appstore_store.do#!/store/application/9b33c83a1bcc5510b76a0d0fdc4bcb21/1.0.0?sl=sh.

Considered mostly for development and testing purposes, as in most cases the default value should be fine.

Starting with release Rome, ServiceNow Table API no longer supports problem state transitions, which is worked around by using this server-side scripted REST API resource.

Default: "/api/x_rhtpp_ansible/problem"

cause_notes

string

Provide information on what caused the problem.

Required if state is in_progress.

Required if state is resolved or closed and resolution_code is fix_applied or risk_accepted.

close_notes

string

The reason for closing the problem.

Required if state is resolved or closed and resolution_code is risk_accepted or canceled.

description

string

Detailed description of the problem.

duplicate_of

string

Number of the problem of which this problem is a duplicate of.

Required if state is resolved or closed and resolution_code is duplicate.

fix_notes

string

Notes on how the problem was fixed.

Required if state is in_progress.

Required if state is resolved or closed and resolution_code is fix_applied.

impact

string

Effect that the problem has on business.

Default choices are low, medium, high. One can override them by setting problem_mapping.impact.

instance

dictionary

ServiceNow instance information.

access_token

string

added in servicenow.itsm 2.3.0

Access token obtained via OAuth authentication.

If not set, the value of the SN_ACCESS_TOKEN environment variable will be used.

api_path

string

added in servicenow.itsm 2.4.0

Change the API endpoint of SNOW instance from default 'api/now'.

Default: "api/now"

client_id

string

ID of the client application used for OAuth authentication.

If not set, the value of the SN_CLIENT_ID environment variable will be used.

If provided, it requires client_secret.

client_secret

string

Secret associated with client_id. Used for OAuth authentication.

If not set, the value of the SN_CLIENT_SECRET environment variable will be used.

If provided, it requires client_id.

custom_headers

dictionary

added in servicenow.itsm 2.4.0

A dictionary containing any extra headers which will be passed with the request.

grant_type

string

added in servicenow.itsm 1.1.0

Grant type used for OAuth authentication.

If not set, the value of the SN_GRANT_TYPE environment variable will be used.

Since version 2.3.0, it no longer has a default value in the argument specifications.

If not set by any means, the default value (that is, password) will be set internally to preserve backwards compatibility.

Choices:

  • "password"

  • "refresh_token"

host

string / required

The ServiceNow host name.

If not set, the value of the SN_HOST environment variable will be used.

password

string

Password used for authentication.

If not set, the value of the SN_PASSWORD environment variable will be used.

Required when using basic authentication or when grant_type=password.

refresh_token

string

added in servicenow.itsm 1.1.0

Refresh token used for OAuth authentication.

If not set, the value of the SN_REFRESH_TOKEN environment variable will be used.

Required when grant_type=refresh_token.

timeout

float

Timeout in seconds for the connection with the ServiceNow instance.

If not set, the value of the SN_TIMEOUT environment variable will be used.

username

string

Username used for authentication.

If not set, the value of the SN_USERNAME environment variable will be used.

Required when using basic authentication or when grant_type=password.

validate_certs

boolean

added in servicenow.itsm 2.3.0

If host's certificate is validated or not.

Choices:

  • false

  • true ← (default)

number

string

Number of the record to operate on.

Note that contrary to sys_id, number may not uniquely identify a record.

other

dictionary

Optional remaining parameters.

For more information on optional parameters, refer to the ServiceNow documentation on creating problems at https://docs.servicenow.com/bundle/tokyo-it-service-management/page/product/problem-management/task/create-a-problem-v2.html.

problem_mapping

dictionary

added in servicenow.itsm 1.3.0

User mapping for Problem object, where user can override Choice Lists values for objects.

impact

dictionary

Effect that the problem has on business.

problem_state

dictionary

State of the problem.

If a problem does not yet exist, all states except for new require setting of assigned_to parameter.

This mapping can also be edited inside Choice Lists inside ServiceNow and can differ from state mapping.

state

dictionary

State of the problem.

If a problem does not yet exist, all states except for new require setting of assigned_to parameter.

Special value that can not be overridden is absent, which would remove a problem from ServiceNow.

urgency

dictionary

The extent to which the problem resolution can bear delay.

resolution_code

string

The reason for problem resolution.

Choices:

  • "fix_applied"

  • "risk_accepted"

  • "duplicate"

  • "canceled"

short_description

string

Short description of the problem that the problem-solving team should address.

Required if the problem does not exist yet.

state

string

State of the problem.

If a problem does not yet exist, all states except for new require setting of assigned_to parameter.

Default choices are new, assess, root_cause_analysis, fix_in_progress, resolved, closed, absent. One can override them by setting problem_mapping.state.

sys_id

string

Unique identifier of the record to operate on.

urgency

string

The extent to which the problem resolution can bear delay.

Default choices are low, medium, high. One can override them by setting problem_mapping.urgency.

- name: Create a problem
  servicenow.itsm.problem:
    state: new
    short_description: Issue with the network printer
    description: Since this morning, all printer jobs are stuck.
    attachments:
      - path: path/to/attachment.txt
    impact: medium
    urgency: low
    other:
      user_input: notes

- name: Assign a problem to a user for assessment
  servicenow.itsm.problem:
    number: PRB0000010
    state: assess
    assigned_to: problem.manager

- name: Mark a problem for root cause analysis
  servicenow.itsm.problem:
    number: PRB0000010
    state: root_cause_analysis

- name: Work on fixing a problem
  servicenow.itsm.problem:
    number: PRB0000010
    state: fix_in_progress
    cause_notes: I identified the issue.
    fix_notes: Fix here.


- name: Close a problem as fixed
  servicenow.itsm.problem:
    number: PRB0000010
    state: closed
    resolution_code: fix_applied
    cause_notes: I found that this doesn't work.
    fix_notes: I solved it like this.

- name: Close a problem as duplicate
  servicenow.itsm.problem:
    number: PRB0000010
    state: closed
    resolution_code: duplicate
    duplicate_of: PRB0000001

- name: Cancel a problem
  servicenow.itsm.problem:
    number: PRB0000010
    state: closed
    resolution_code: canceled
    close_notes: The problem seems to have resolved itself.

- name: Delete a problem
  servicenow.itsm.problem:
    number: PRB0000010
    state: absent

The following are the fields unique to this module:

Key

Description

record

dictionary

The problem record.

Returned: success

Sample: {"active": "true", "activity_due": "", "additional_assignee_list": "", "approval": "not requested", "approval_history": "", "approval_set": "", "assigned_to": "73ab3f173b331300ad3cc9bb34efc4df", "assignment_group": "", "attachments": [{"average_image_color": "", "chunk_size_bytes": "700000", "compressed": "true", "content_type": "text/plain", "download_link": "https://www.example.com/api/now/attachment/31cdf4d50706301022f9ffa08c1ed07f/file", "file_name": "sample_file1.txt", "hash": "6f2b0dec698566114435a23f15dcac848a40e1fd3e0eda4afe24a663dda23f2e", "image_height": "", "image_width": "", "size_bytes": "210", "size_compressed": "206", "state": "pending", "sys_created_by": "admin", "sys_created_on": "2021-08-17 11:19:49", "sys_id": "31cdf4d50706301022f9ffa08c1ed07f", "sys_mod_count": "0", "sys_tags": "", "sys_updated_by": "admin", "sys_updated_on": "2021-08-17 11:19:49", "table_name": "problem", "table_sys_id": "6dcdb4d50706301022f9ffa08c1ed0fb"}], "business_duration": "", "business_service": "", "calendar_duration": "", "category": "software", "cause_notes": "", "close_notes": "", "closed_at": "", "closed_by": "", "cmdb_ci": "27d32778c0a8000b00db970eeaa60f16", "comments": "", "comments_and_work_notes": "", "company": "", "confirmed_at": "", "confirmed_by": "", "contact_type": "", "contract": "", "correlation_display": "", "correlation_id": "", "delivery_plan": "", "delivery_task": "", "description": "Unable to send or receive emails.", "due_date": "", "duplicate_of": "", "escalation": "0", "expected_start": "", "first_reported_by_task": "", "fix_communicated_at": "", "fix_communicated_by": "", "fix_notes": "", "follow_up": "", "group_list": "", "impact": "low", "knowledge": "false", "known_error": "false", "location": "", "made_sla": "true", "major_problem": "false", "number": "PRB0007601", "opened_at": "2018-08-30 08:08:39", "opened_by": "6816f79cc0a8016401c5a33be04be441", "order": "", "parent": "", "priority": "5", "problem_state": "new", "reassignment_count": "0", "related_incidents": "0", "reopen_count": "0", "reopened_at": "", "reopened_by": "", "resolution_code": "", "resolved_at": "", "resolved_by": "", "review_outcome": "", "rfc": "", "route_reason": "", "service_offering": "", "short_description": "Unable to send or receive emails.", "sla_due": "", "state": "new", "subcategory": "email", "sys_class_name": "problem", "sys_created_by": "admin", "sys_created_on": "2018-08-30 08:09:05", "sys_domain": "global", "sys_domain_path": "/", "sys_id": "62304320731823002728660c4cf6a7e8", "sys_mod_count": "1", "sys_tags": "", "sys_updated_by": "admin", "sys_updated_on": "2018-12-12 07:16:57", "task_effective_number": "PRB0007601", "time_worked": "", "universal_request": "", "upon_approval": "proceed", "upon_reject": "cancel", "urgency": "low", "user_input": "", "watch_list": "", "work_end": "", "work_notes": "", "work_notes_list": "", "work_start": "", "workaround": "", "workaround_applied": "false", "workaround_communicated_at": "", "workaround_communicated_by": ""}

Authors

  • Manca Bizjak (@mancabizjak)
  • Miha Dolinar (@mdolin)
  • Tadej Borovsak (@tadeboro)
  • Matej Pevec (@mysteriouswolf)
  • Uros Pascinski (@uscinski)

Collection links