snow_record

pdk
tasks
Series of tasks to interact with a ServiceNow Instance

Abir Majumdar

beersy

3,864 downloads

3,499 latest version

5.0 quality score

Version information

  • 0.1.4 (latest)
  • 0.1.3
  • 0.1.2
  • 0.1.1
  • 0.1.0
released Aug 8th 2019
This version is compatible with:
  • Puppet Enterprise 2019.8.x, 2019.7.x, 2019.5.x, 2019.4.x, 2019.3.x, 2019.2.x, 2019.1.x, 2019.0.x, 2018.1.x, 2017.3.x, 2017.2.x, 2016.4.x
  • Puppet >= 4.10.0 < 7.0.0
  • CentOS
    ,
    OracleLinux
    ,
    RedHat
    ,
    Scientific
    ,
    Debian
    ,
    Ubuntu
Tasks:
  • create
  • create_incident
  • read
  • resolve_incident
  • update
Plans:
  • example

Start using this module

Documentation

beersy/snow_record — version 0.1.4 Aug 8th 2019

Build Status Puppet Forge

snow_record

This task manage records in ServiceNow.

Table of Contents

  1. Description
  2. Setup - The basics of getting started with snow_record
  3. Usage - Configuration options and additional functionality
  4. Examples
  5. Limitations - OS compatibility, etc.
  6. Development - Guide for contributing to the module

Description

snow_record provides a series of tasks to interact with a ServiceNow Instance. The main 3 tasks included with this module:

  • create - Create a ServiceNow object
  • read - Get a ServiceNow object
  • update - Update a ServiceNow object

There are also 2 additional tasks for interacting with Incidents.

  • create_incident - Create an Incident
  • resolve_incident - Resolve an Incident

Please read the Limitations before running these additional tasks.

Setup

Requirement for executing task

The puppetlabs-ruby_task_helper module should be installed

Usage

The tasks can be executed from bolt by supplying an basic inventory file:

  • name ServiceNow Instance [name]..service-now.com
  • config of which:
    • transport Always remote
  • remote:
    • user: ServiceNow Username
    • password: ServiceNow Password

For example:

nodes:
  - name: dev85564
    config:
      transport: remote
      remote:
        user: admin
        password: "XHxH2tmZ69*Vbh"

Examples

Getting incident INC000701

bolt task run --nodes dev85564 snow_record::read number=INC000701

Getting incident from sys_id

bolt task run --nodes dev85564 snow_record::read lookup_field=sys_id number=ff4d21c4735123002728660c4cf6a758

Getting user record from sys_id

bolt task run --nodes dev85564 snow_record::read table=sys_user lookup_field=sys_id number=fe82abf0371000044e0bfc8bcbe5d34

Creating an user

bolt task run --nodes dev85564 snow_record::create table=sys_user data='{"first_name":"Frank","last_name":"Sinatra"}'

Updating a user's city (using Update)

bolt task run --nodes dev85564 snow_record::update table=sys_user sys_id=fe82abf03710400044e0bfc8bcbe5d34 data='{"city":"Pittsburgh"}'

Creating an incident

bolt task run --nodes dev85564 snow_record::create_incident urgency=1 priority=2 severity=3 additional_data='{"short_description":"This is a test incident opened by Puppet"}'

Resolving an incident

bolt task run --nodes dev85564 snow_record::resolve_incident sys_id=fa8ecfe6db8363009395af264896199e close_notes="Closing Time1" additional_data='{"close_code":"Solved (Work Around)"}'

A Sample plan

A sample plan is included in the plans folder.

bolt plan run snow_record::example nodes=dev85564

Limitations

These tasks have been tested with a Madrid developer instance. The task has been tested on macOS and Centos.

ServiceNow is a highly customized environment. create_incident and resolve_incident assume your incident states are similar to the default developer instance. If the create_incident and resolve_incident don't work for you, use the more generic create and update tasks.

Development

TODOS:

  • Add more error handling
  • Add more convenience tasks
  • Add delete

Feel free to contribute. PRs on github always appreciated!

Release Notes/Contributors/Etc. Optional

0.1 Initial release