Classes
servicenow::server_prerequisites
: Installs the packages/gems required to make the server-side ServiceNow API work.
Functions
servicenow_cmdbi_lookup_attribute
: Exposes aservicenow::cmdbi::...
namespace to lookup ServiceNow CMDB class instance attributes from Hiera (cmdbi as in instance, versus met
Data types
Servicenow::Sys_id
: Internal IDs used by ServiceNow on most objects
Tasks
create_table_record
: Create a new Table record (most ServiceNow objects), returns its attributesget_cmdbi_attribute
: Get a single attribute from a CI or other CMDB instance record and return it in the "value" key. Not cached.get_cmdbi_record
: Get a CI or other CMDB instance record and return it in the "attributes" and *relations key. Not cached.get_table_attribute
: Get a single attribute from a Table record (most ServiceNow objects)get_table_record
: Get a Table record (most ServiceNow objects) and return the hash of attributesupdate_cmdbi_record
: Set attributes on a CI or other CMDB instance recordupdate_table_record
: Set attributes on a Table record (most ServiceNow objects)
Plans
servicenow::test_cmdbi_ru
: End-to-end test for CMDB Instance retrieve / update.servicenow::test_table
: End-to-end test for Table Record tasks.
Installs the packages/gems required to make the server-side ServiceNow API work.
Type: Ruby 4.x API
Exposes a servicenow::cmdbi::...
namespace to lookup ServiceNow CMDB
class instance attributes from Hiera (cmdbi as in instance, versus metadata).
The only supported format for now is:
servicenow::cmdbi::<class>::by_sys_id::<sys_id>::<attribute>
with <class>
the technical name (for example cmdb_ci_appl, not
Applications), <sys_id>
the internal 32 chars GUID, and <attribute>
the
technical name of the attribute. Most technical stuff can be figured out from
ServiceNow URLs.
The Hiera options must contain a path-like configuration (path, paths, glob, globs, although it's unlikely you'll ever need more than "path"). That path must point to YAML-formatted credentials file. See the README for more information.
servicenow_cmdbi_lookup_attribute(Variant[String, Numeric] $key, Hash $options, Puppet::LookupContext $context)
Exposes a servicenow::cmdbi::...
namespace to lookup ServiceNow CMDB
class instance attributes from Hiera (cmdbi as in instance, versus metadata).
The only supported format for now is:
servicenow::cmdbi::<class>::by_sys_id::<sys_id>::<attribute>
with <class>
the technical name (for example cmdb_ci_appl, not
Applications), <sys_id>
the internal 32 chars GUID, and <attribute>
the
technical name of the attribute. Most technical stuff can be figured out from
ServiceNow URLs.
The Hiera options must contain a path-like configuration (path, paths, glob, globs, although it's unlikely you'll ever need more than "path"). That path must point to YAML-formatted credentials file. See the README for more information.
Returns: Any
The (possibly cached) attribute. A String or some more complex
Data type: Variant[String, Numeric]
Key in format
Data type: Hash
Hiera options. Must contain a path
-like entry.
Data type: Puppet::LookupContext
Standard argument.
Internal IDs used by ServiceNow on most objects
Alias of Pattern[/\A\h{32}\Z/]
Create a new Table record (most ServiceNow objects), returns its attributes
Supports noop? false
Data type: String[1]
Internal table name, for example incident
Data type: Hash[String[1], Any]
Initial attributes (field values) the Record should have.
Get a single attribute from a CI or other CMDB instance record and return it in the "value" key. Not cached.
Supports noop? false
Data type: String[1]
Class of the CI, determines the visible attributes
Data type: Servicenow::Sys_id
Unique ID of the CI, visible in the browser's URL
Data type: String[1]
Which attribute to return, for example version
Get a CI or other CMDB instance record and return it in the "attributes" and *relations key. Not cached.
Supports noop? false
Data type: String[1]
Class of the CI, determines the visible attributes
Data type: Servicenow::Sys_id
Unique ID of the CI, visible in the browser's URL
Get a single attribute from a Table record (most ServiceNow objects)
Supports noop? false
Data type: String[1]
Internal table name, for example change_request
Data type: Servicenow::Sys_id
Unique ID of the record, visible in the browser's URL
Data type: String[1]
Which field to return, for example description
Get a Table record (most ServiceNow objects) and return the hash of attributes
Supports noop? false
Data type: String[1]
Internal table name, for example change_request
Data type: Servicenow::Sys_id
Unique ID of the record, visible in the browser's URL
Set attributes on a CI or other CMDB instance record
Supports noop? false
Data type: String[1]
Class of the CI, determines the visible attributes
Data type: Servicenow::Sys_id
Unique ID of the CI, visible in the browser's URL
Data type: Hash[String[1], Any]
What to update on that CI, for example {"version": "1.2.3"}
Set attributes on a Table record (most ServiceNow objects)
Supports noop? false
Data type: String[1]
Internal table name, for example change_request
Data type: Servicenow::Sys_id
Unique ID of the record, visible in the browser's URL
Data type: Hash[String[1], Any]
What to update on that record, for example {"work_notes": "I did stuff"}
This test updates the attribute of an existing CI to a new value, ensure it is as expected, and rolls back the change.
You'll need to provide a sys_id
of an Application in your CMDB and a
target_value
different from its current value.
The following parameters are available in the servicenow::test_cmdbi_ru
plan.
Data type: TargetSpec
Must match the ServiceNow entry in your inventory. Multiple nodes are not supported.
Data type: String[1]
Internal ServiceNow class name for the CI.
Default value: 'cmdb_ci_appl'
Data type: Servicenow::Sys_id
Internal ServiceNow identifier for an existing CI.
Default value: '6ed461b5dbaf13c4a38b9637db961996'
Data type: String[1]
CI attribute we'll test updating.
Default value: 'version'
Data type: String[1]
The value we'll set the attribute to.
Default value: '1.2.3'
This test:
- Creates a new incident.
- Updates its short description.
- Verifies it is set as expected.
The incident is not deleted afterwards because the user running the test may not have the right to do so. The test is not expected to be run on a production ServiceNow instance.
The following parameters are available in the servicenow::test_table
plan.
Data type: TargetSpec
Must match the ServiceNow entry in your inventory. Multiple nodes are not supported.
Data type: String[1]
Internal ServiceNow table name.
Default value: 'incident'
Data type: String[1]
Table attribute (field) we'll test updating.
Default value: 'short_description'
Data type: String[1]
The value we'll set the attribute to at first.
Default value: 'Test from Bolt - init'
Data type: String[1]
The value we'll set the attribute to when updating the record.
Default value: 'Test from Bolt - updated'