CMDB Management
Learn how to automate ServiceNow Configuration Management Database (CMDB) operations using Ansible to query and update configuration items.
Introduction
In ITIL, a Configuration Management Database (CMDB) is a centralized repository that organizations use to track hardware and software assets throughout their lifecycle. The ServiceNow CMDB serves as the single source of truth for IT asset management, providing:
-
Asset Tracking: Complete inventory of IT infrastructure components
-
Relationship Mapping: Dependencies and connections between configuration items
-
Change Impact Analysis: Understanding how changes affect related systems
-
Service Mapping: Linking business services to underlying infrastructure
Configuration Items (CIs)
Configuration Items represent individual components in your IT infrastructure:
-
Hardware: Servers, network devices, storage systems
-
Software: Applications, operating systems, databases
-
Services: Business services, technical services
-
Documentation: Procedures, policies, service level agreements
CMDB Automation Benefits
Using Ansible to automate CMDB operations provides:
-
Accuracy: Automated data collection reduces manual entry errors
-
Consistency: Standardized data formats and update procedures
-
Timeliness: Real-time updates as infrastructure changes
-
Integration: Seamless connection with existing automation workflows
Lab Environment Setup
For this module, two Red Hat Enterprise Linux (RHEL) servers have been automatically provisioned:
-
node1: Primary test server
-
node2: Secondary test server
These servers have been added to the Automation Controller inventory and are ready for CMDB integration.
Review the Playbooks
Two specialized playbooks have been created in your VS Code workspace:
-
collect-node-info.yml: Gathers detailed information about the RHEL nodes -
create-update-config-items.yml: Creates or updates configuration items in the CMDB
-
Open the VS Code tab in your lab environment
-
Review
collect-node-info.ymlto understand data collection methods -
Examine
create-update-config-items.ymlto see how CI updates work -
Note the data mapping between Ansible facts and ServiceNow fields
Current CMDB State
Before running the automation, examine the current state of Linux configuration items:
-
Access the ServiceNow tab
-
In the filter navigator, type "Linux"
-
Navigate to Configuration → Servers → Linux
-
Review the current list of Linux server configuration items
Note the current number of Linux servers and their details - you’ll compare this after running the automation.
Query Nodes and Update CMDB
Execute the workflow to collect node information and update the ServiceNow CMDB with configuration items.
Workflow Job Template
The CMDB automation has been implemented as a Workflow Job Template that combines multiple operations:
-
Navigate to the Automation Controller tab
-
Go to Automation Execution → Templates
-
Locate the
4.0 - Query node info and update CMDB (multiple job templates)workflow -
Click the rocket icon (🚀) to launch the workflow
Workflow Visualization
The Workflow Job Template includes a visualization feature:
-
Workflow Map: Visual representation of job dependencies and flow
-
Real-time Status: Live updates showing job progress
-
Interactive Nodes: Click on workflow nodes to view individual job details
-
Parallel Execution: Multiple jobs running simultaneously for efficiency
-
After launching the workflow, look for the visualization button
-
Click the visualization icon to open the workflow map
-
Observe the job nodes and their execution status
-
Click on individual nodes to view job details and output
-
Monitor the overall workflow progress
Workflow Components
The workflow typically includes these phases:
-
Discovery Phase: Collect system information from target nodes
-
Data Processing: Transform collected data into ServiceNow format
-
CMDB Update: Create or update configuration items
-
Relationship Mapping: Establish connections between CIs
-
Validation: Verify successful CMDB updates
Inspect Results
Verify that the configuration items were successfully created or updated in the ServiceNow CMDB.
Verify CMDB Updates
-
Return to the ServiceNow tab
-
In the filter navigator, type "Linux"
-
Navigate to Configuration → Servers → Linux
-
Review the updated list of Linux server configuration items
-
Compare with the initial state you observed earlier
Expected Results
You should observe the following changes:
-
New Configuration Items: Two new Linux server CIs (node1 and node2)
-
IP Address Population: Network information automatically populated
-
System Details: Hardware and software specifications included
-
Timestamps: Creation or update times reflecting the automation execution
Configuration Item Details
Click on each new configuration item to examine the populated fields:
| Field Category | Expected Information |
|---|---|
Basic Information |
Hostname, FQDN, operating system |
Network Details |
IP addresses, MAC addresses, network interfaces |
Hardware Specs |
CPU count, memory, disk space |
Software Info |
Operating system version, installed packages |
Discovery Data |
Last discovered date, discovery source |
Data Accuracy Validation
Verify that the automated data collection captured accurate information:
-
IP Addresses: Should match the actual node network configuration
-
System Specifications: CPU, memory, and disk information should be current
-
OS Details: Operating system version and architecture should be correct
-
Hostnames: Should correspond to the actual server names (node1, node2)
Understanding CMDB Automation
This module demonstrates several key concepts:
-
Automated Discovery: How Ansible can collect system information
-
Data Transformation: Converting system facts to ServiceNow format
-
CMDB Integration: Programmatic creation and updating of CIs
-
Workflow Orchestration: Coordinating multiple automation tasks
Next Steps
With your CMDB successfully updated with new configuration items, you’re ready to proceed to Module 5, where you’ll learn about automated record cleanup and maintenance tasks.
Troubleshooting
If you have encountered an issue or have noticed something not quite right, please open an issue on GitHub.