Use servicenow CMDB as inventory source for AWX

There is currently no integration of the servicenow inventory plugin into the AWX GUI or API. We are going to implement it as a Source from Project. Open a new project or use an existing suitable project.

Add collection servicenow.itsm, which will be needed for this project. To do this, add the following file to your project with the content:

---
# collections/requirements.yml
collections:
- servicenow.itsm
Create an inventory source file. It should be called now.yml and here is an example of its contents:
---
# inventories/now.yml
plugin: servicenow.itsm.now
columns:
- os
- name
- ip_address
- fqdn

Commit changes to the project and update it or set up a new project in AWX.

Create a new Credential Types, name it ServiceNow and fill the following details:

Input configuration
-------------------
fields:
  - id: hosturl
    type: string
    label: hosturl
  - id: user
    type: string
    label: user
  - id: password
    type: string
    label: password
    secret: true
required:
  - hosturl
  - user
  - password
Injector configuration
----------------------
env:
  SN_HOST: '{{ hosturl }}'
  SN_PASSWORD: '{{ password }}'
  SN_USERNAME: '{{ user }}'

Then, define a new credentials for your servicenow host.

The last step is to configure an inventory Source. Make it Sourced from a Project, select Project and put inventories/now.yml as an "Inventory file". Use previously defined credential for this source.

If you want to query another CMDB table, you can add another now.yml file and create another query. This is an example to query a vmware data:

---
# inventories/vmware/now.yml
plugin: servicenow.itsm.now
strict: no
table: cmdb_ci_vmware_instance
columns:
  - object_id
  - bios_uuid
  - vcenter_ref
keyed_groups:
  - key: vcenter_ref
    prefix: vc
compose:
    datastore: image_path|regex_search(r"\[([^\]]+)\]",'\1') 
query:
  - sys_class_name: = cmdb_ci_vmware_instance

Your table fields may be differ, but an idea is clear.

Then add a second inventory source from Project and point an inventory file to a new file. The limitation is that this file HAVE TO BE called now.yml


Updated on Sun Nov 16 11:44:29 IST 2025 More documentations here