Skip to content

Latest commit

 

History

History
170 lines (161 loc) · 3.99 KB

inventory.md

File metadata and controls

170 lines (161 loc) · 3.99 KB

servicenow.servicenow.now - ServiceNow Inventory Plugin

Synopsis

  • ServiceNow Inventory plugin

Requirements

  • requests
  • netaddr

Parameters

Parameter Choices/Defaults Configuration Comments
username
env:
- name: SN_USERNAME
Name of user for connection to ServiceNow. If the value is not specified, the value of environment variable C(SN_USERNAME) will be used instead.
plugin

required

Choices:
- servicenow.servicenow.now
The name of the ServiceNow Inventory Plugin, this should always be 'servicenow.servicenow.now'.
fields
Default:
ip_address,fqdn,host_name,sys_class_name,name
Comma seperated string providing additional table columns to add as host vars to each inventory host.
instance
env:
- name: SN_INSTANCE
The ServiceNow instance name, without the domain, service-now.com. If the value is not specified in the task, the value of environment variable C(SN_INSTANCE) will be used instead.
host
env:
- name: SN_HOST
The ServiceNow hostname. This value is FQDN for ServiceNow host. If the value is not specified in the task, the value of environment variable C(SN_HOST) will be used instead. Mutually exclusive with C(instance).
filter_results
Default:
Filter results with sysparm_query encoded query string syntax. Complete list of operators available for filters and queries.
proxy
Default:
Proxy server to use for requests to ServiceNow.
enhanced
Default:
False
enable enhanced inventory which provides relationship information from CMDB. Requires installation of Update Set.
selection_order
Default:
ip_address,fqdn,host_name,name
Comma seperated string providing ability to define selection preference order.
table
Default:
cmdb_ci_server
The ServiceNow table to query
enhanced_groups
Default:
True
enable enhanced groups from CMDB relationships. Only used if enhanced is enabled.
password

required

env:
- name: SN_PASSWORD
Password for username. If the value is not specified, the value of environment variable C(SN_PASSWORD) will be used instead.

Examples


plugin: servicenow.servicenow.now
instance: dev89007
username: admin
password: password
keyed_groups:
  - key: sn_sys_class_name | lower
    prefix: ''
    separator: ''

plugin: servicenow.servicenow.now
host: servicenow.mydomain.com
username: admin
password: password
fields: [name,host_name,fqdn,ip_address,sys_class_name, install_status, classification,vendor]
keyed_groups:
  - key: sn_classification | lower
    prefix: 'env'
  - key: sn_vendor | lower
    prefix: ''
    separator: ''
  - key: sn_sys_class_name | lower
    prefix: ''
    separator: ''
  - key: sn_install_status | lower
    prefix: 'status'

plugin: servicenow.servicenow.now
instance: dev89007
username: admin
password: password
fields:
  - name
  - sys_tags
compose:
  sn_tags: sn_sys_tags.replace(" ", "").split(',')
  ansible_host: sn_ip_address
keyed_groups:
  - key: sn_tags | lower
    prefix: 'tag'