Forge Home

servicenow_cmdb_data

Puppet module to set up data retrieval from ServiceNow CMDB for use by Hiera and as external facts

6,741 downloads

5,613 latest version

5.0 quality score

We run a couple of automated
scans to help you access a
module's quality. Each module is
given a score based on how well
the author has formatted their
code and documentation and
modules are also checked for
malware using VirusTotal.

Please note, the information below
is for guidance only and neither of
these methods should be considered
an endorsement by Puppet.

Support the Puppet Community by contributing to this module

You are welcome to contribute to this module by suggesting new features, currency updates, or fixes. Every contribution is valuable to help ensure that the module remains compatible with the latest Puppet versions and continues to meet community needs. Complete the following steps:

  1. Review the module’s contribution guidelines and any licenses. Ensure that your planned contribution aligns with the author’s standards and any legal requirements.
  2. Fork the repository on GitHub, make changes on a branch of your fork, and submit a pull request. The pull request must clearly document your proposed change.

For questions about updating the module, contact the module’s author.

Version information

  • 0.4.0 (latest)
  • 0.3.1
  • 0.2.0
  • 0.1.0
released May 28th 2018
This version is compatible with:
  • Puppet Enterprise 2018.1.x, 2017.3.x, 2017.2.x, 2017.1.x, 2016.5.x, 2016.4.x
  • Puppet >= 4.7.0 < 6.0.0
  • ,

Start using this module

  • r10k or Code Manager
  • Bolt
  • Manual installation
  • Direct download

Add this module to your Puppetfile:

mod 'jesse-servicenow_cmdb_data', '0.4.0'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add jesse-servicenow_cmdb_data
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install jesse-servicenow_cmdb_data --version 0.4.0

Direct download is not typically how you would use a Puppet module to manage your infrastructure, but you may want to download the module in order to inspect the code.

Download

Documentation

jesse/servicenow_cmdb_data — version 0.4.0 May 28th 2018

servicenow_cmdb_data

build status

This module installs a ruby script, config file, data directory, and cron job that retrieves selected fields from a ServiceNow CMDB instances' cmdb_ci_server table. It writes out the data in a json format consumable by Hiera.

Table of Contents

  1. Setup

Setup

Setup Requirements

Required Ruby Gems (as tested with)

  • rest-client (1.8.0)
  • http-cookie (1.0.3)
  • domain_name (0.5.20180417)
  • unf 0.1.4
  • unf_ext 0.0.7.5
  • mime-types (2.99.3)
  • netrc (0.11.0)

Note that some of the above gems require development tools to be installed for the gem install step to succeed as they require native code to be compiled (eg unf, unf_ext).

Beginning with servicenow_cmdb_data

Include the class on the Puppet Master (or Master of Masters)

include servicenow_cmdb_data

and supply at a minimum the following keys in Hiera:

servicenow_cmdb_data::servicenow_endpoint: https://exampleorg.service-now.com/api/now/table/cmdb_ci_server
servicenow_cmdb_data::servicenow_username: aaaaaaaa
servicenow_cmdb_data::servicenow_password: bbbbbbbb

Alternatively, use the resource syntax to include these parameters in your Puppet code:

class { 'servicenow_cmdb_data':
  servicenow_endpoint => 'https://exampleorg.service-now.com/api/now/table/cmdb_ci_server',
  servicenow_username => 'aaaaaaaa',
  servicenow_password => 'bbbbbbbb',
}

Reference

The servicenow_cmdb_data class has the following parameters:

  • servicenow_endpoint - required - the URL of the ServiceNow cmdb_ci_server table API, eg https://exampleorg.service-now.com/api/now/table/cmdb_ci_server
  • servicenow_username - required - ServiceNow API User
  • servicenow_password - required - ServiceNow API Password
  • appdir - default: /opt/servicenow_cmdb_data - directory to use - has sub-directories exe, config, data, log
  • user - the system user to own the files and run the retrieval script as
  • proxy - optional proxy URL to use
  • servicenow_query_list - list of queries to include in the request to ServiceNow CMDB. Consult data/default.yaml for the defaut set of queries
  • servicenow_field_list - list of fields to request ServiceNow CMDB to return for each object
  • servicenow_extra_args - list of additional arguments to include in the ServiceNow CMDB URL, eg sysparm_display_value=true; default: undef
  • key_prefix - string to prepend each key in the output JSON data file with, default: cmdb_by_fqdn
  • manage_user - whether to manage the system user specified in user, default: true
  • cron_hour - value of the hour field for the cron job, default: * (no restriction on hour-of-day)
  • cron_minute - value of the minute field for the cron job, default: */5 (run the job every 5 minutes)

To Do

  • Add a class that automatically creates external facts corresponding to each of the retrieved fields, prefacing them with something configurable eg "cmdb_"
  • Consider what kind of validation could be done before overwriting the JSON file, eg a large percentage difference in the number of servers (or requiring existence of at least x servers in the dump for it to be valid).