# \[AWX-17.1.0\] ServiceNow Inventory Plugin doesn't create host groups

**URL:** <https://forum.ansible.com/t/awx-17-1-0-servicenow-inventory-plugin-doesnt-create-host-groups/35062>\
**Category:** AWX Project\
**Tags:** awx\
**Created:** [April 27, 2021, 7:10am UTC](https://forum.ansible.com/t/awx-17-1-0-servicenow-inventory-plugin-doesnt-create-host-groups/35062 "2021-04-27T07:10:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marek\_Z](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/marek_z/32/7929_2.png) [@Marek\_Z](https://forum.ansible.com/u/Marek_Z)\
**Post date:** [April 27, 2021, 7:10am UTC](https://forum.ansible.com/t/awx-17-1-0-servicenow-inventory-plugin-doesnt-create-host-groups/35062/1 "2021-04-27T07:10:01Z")

</div>

Hi.

Recently I managed to configure a template that fetches CMDB from ServiceNow and it _kind of_ works. This is the article I followed:  
[http://gregsowell.com/?p=6618](http://gregsowell.com/?p=6618)  
I added some extra keyed groups:

keyed\_groups:

- key: device\_type | lower  
prefix: ‘’  
separator: ‘’
- key: u\_firmware\_type | upper  
prefix: ‘’  
separator: ‘’
- key: u\_part\_name2 | upper  
prefix: ‘’  
separator: ‘’
- key: location  
prefix: ‘’  
separator: ‘’
- key: install\_status  
prefix: ‘’  
separator: ‘’

But none of them are created. See output below:

ansible-inventory 2.9.18  
config file = /etc/ansible/ansible.cfg  
configured module search path = [‘/var/lib/awx/.ansible/plugins/modules’, ‘/usr/share/ansible/plugins/modules’]  
ansible python module location = /usr/lib/python3.6/site-packages/ansible  
executable location = /usr/bin/ansible-inventory  
python version = 3.6.8 (default, Aug 24 2020, 17:57:11) [GCC 8.3.1 20191121 (Red Hat 8.3.1-5)]  
Using /etc/ansible/ansible.cfg as config file  
host\_list declined parsing /tmp/bwrap\_212\_ny01v3ue/awx\_212\_njxbvlnw/project/collections/requirements.yml as it did not pass its verify\_file() method  
script declined parsing /tmp/bwrap\_212\_ny01v3ue/awx\_212\_njxbvlnw/project/collections/requirements.yml as it did not pass its verify\_file() method  
[WARNING]: Skipping ‘collections’ as this is not a valid group definition  
Parsed /tmp/bwrap\_212\_ny01v3ue/awx\_212\_njxbvlnw/project/collections/requirements.yml inventory source with yaml plugin  
host\_list declined parsing /tmp/bwrap\_212\_ny01v3ue/awx\_212\_njxbvlnw/project/snow-switch-now.yml as it did not pass its verify\_file() method  
script declined parsing /tmp/bwrap\_212\_ny01v3ue/awx\_212\_njxbvlnw/project/snow-switch-now.yml as it did not pass its verify\_file() method  
Connecting to…[https://COMPANY.service-now.com//api/now/table/cmdb\_ci\_ip\_switch?sysparm\_exclude\_reference\_link=true&sysparm\_display\_value=true&sysparm\_fields=sys\_id,name,ip\_address,operational\_status,firmware\_version,serial\_number,u\_firmware\_type,device\_type,u\_part\_name2,location,install\_status&sysparm\_query=](https://COMPANY.service-now.com//api/now/table/cmdb_ci_ip_switch?sysparm_exclude_reference_link=true&sysparm_display_value=true&sysparm_fields=sys_id,name,ip_address,operational_status,firmware_version,serial_number,u_firmware_type,device_type,u_part_name2,location,install_status&sysparm_query=)  
Parsed /tmp/bwrap\_212\_ny01v3ue/awx\_212\_njxbvlnw/project/snow-switch-now.yml inventory source with auto plugin  
24.659 INFO Processing JSON output…  
25.043 INFO Loaded 0 groups, 3555 hosts  
25.609 INFO Inventory import completed for ServiceNow Switches in 1.0s

Would it be something related to the plugin itself or v17.1?

Regards,  
Marek

---

<div class="post-metadata">

**Author:** ![Marek\_Z](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/marek_z/32/7929_2.png) [@Marek\_Z](https://forum.ansible.com/u/Marek_Z)\
**Post date:** [April 28, 2021, 3:23pm UTC](https://forum.ansible.com/t/awx-17-1-0-servicenow-inventory-plugin-doesnt-create-host-groups/35062/2 "2021-04-28T15:23:35Z")

</div>

OK, I’ll answer myself.  
It seems that ServiceNow plugin prefixes all host\_vars with “sn\_”. Therefore I had to change keys in keyed\_groups section to values saved by the plugin (i.e. I queried for field “u\_firmware\_type”, which has been saved as “sn\_u\_firmware\_type”).

All groups were created afterwards.

Hopefully it’ll save people time.

BR,  
Marek
