ServiceNow CMDB

Configure and use the OneFuse ServiceNow CMDB module with Red Hat Ansible

To learn more about this OneFuse module, refer to ServiceNow CMDB.

Prerequisites

  1. Configure OneFuse Manager
  2. Review an overview on OneFuse Modules with OneFuse Ansible Module

Ansible OneFuse Module name

  • Ansible OneFuse Module name for this OneFuse Module is: cmdb

present

Run Provisioning IRE Template(s) configured on the OneFuse ServiceNow CMDB Policy for a resource.

Sample Play

- name: OneFuse ServiceNow CMDB - present
  hosts: localhost
  gather_facts: false
  vars:
    policy_name: <REPLACEME_with_OneFusePolicyName>
  tasks:
  - name: Create ServiceNow CMDB CI Record
    onefuse:
     module: cmdb
     state: present
     policy_name: '{{ policy_name }}'
     template_properties: {}
     tracking_id: '{{ tracking_id  | default(omit) }}'
    delegate_to: localhost
    register: output
  - name: Output Results
    debug:
      msg: '{{ output }}'
  - name: "Pass ServiceNow CMDB Outputs to workflow"
    set_stats:
        data:
         onefuse_cmdb: '{{ onefuse_cmdb }}'
         tracking_id: '{{ tracking_id }}'

Parameter references

The following defines the function of each ServiceNow CMDB specific Task Parameters for onefuse.

Parameter Name Required? Notes
module Required OneFuse Module Name (string). (Refer to Module names for OneFuse modules.)
state Required present for provision, or the appropriate “update” state for the OneFuse Module.
policy_name Required OneFuse Module Policy Name (string).
template_properties Optional Additional properties that are referenced within the Policy. Python dict format.
tracking_id Optional Tracking ID (string) to link multiple OneFuse Policy Executions and resulting OneFuse Managed Objects together. If none is passed, one gets generated by OneFuse for that specific Policy Execution. Recommended value: {{ tracking_id | default(omit) }}

Update

Run Update IRE Template(s), if configured on the OneFuse ServiceNow CMDB Policy, for a resource.

Sample play

A sample play is coming soon.

Parameter references

The following defines the function of the Task Parameters for onefuse.

Parameter Name Required? Notes
template_properties Optional Additional properties that are referenced within the Policy.
Python dict format.
cmdb_id Required ID of the OneFuse ServiceNow CMDB Deployment Managed Object

absent

Run Deprovisioning IRE Template(s), if configured on the OneFuse ServiceNow CMDB Policy, for a resource.

Sample Play

- name: OneFuse ServiceNow CMDB - absent
  hosts: '{{ ansible_hosts }}'
  gather_facts: false
  tasks:
  - name: Update CMDB Record and run Deprovisioning IRE Template
    onefuse:
      module: cmdb
      state: absent
      object_name: '{{ onefuse_cmdb.id | default(omit) }}'
    delegate_to: localhost
    register: output
  - name: Output Results
    debug:
      msg: '{{ output }}'

Parameter references

The following defines the function of the Task Parameters for onefuse.

Parameter Name Required? Notes
module Required OneFuse Module Name (string). (Refer to Module names for OneFuse modules.)
state Required absent for deprovision.
object_name Required OneFuse Managed Object ID (string).