# Service now dynamic inventory

**URL:** <https://forum.ansible.com/t/service-now-dynamic-inventory/18730>\
**Category:** Ansible Developer\
**Created:** [July 10, 2015, 10:43pm UTC](https://forum.ansible.com/t/service-now-dynamic-inventory/18730 "2015-07-10T22:43:22Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael\_Perzel](https://avatars.discourse-cdn.com/v4/letter/m/8491ac/32.png) [@Michael\_Perzel](https://forum.ansible.com/u/Michael_Perzel)\
**Post date:** [July 10, 2015, 10:43pm UTC](https://forum.ansible.com/t/service-now-dynamic-inventory/18730/1 "2015-07-10T22:43:22Z")

</div>

Has anyone written a dynamic inventory script that integrates with service now's cmdb/discovery? My company has decided to use service now's cmdb so I guess I should leverage it for our inventory.

---

<div class="post-metadata">

**Author:** ![Rohit\_Kothari](https://avatars.discourse-cdn.com/v4/letter/r/ccd318/32.png) [@Rohit\_Kothari](https://forum.ansible.com/u/Rohit_Kothari)\
**Post date:** [July 20, 2015, 4:31pm UTC](https://forum.ansible.com/t/service-now-dynamic-inventory/18730/2 "2015-07-20T16:31:58Z")

</div>

Hello Michael,

We have published a dynamic inventory script for generating inventory from ServiceNow’s CMDB that can be used by Ansible playbooks. Here it is:  
[https://github.com/juniper-it/ansible-jnpr-modules/tree/master/inventory\_plugins](https://github.com/juniper-it/ansible-jnpr-modules/tree/master/inventory_plugins)

Thanks,  
Rohit

---

<div class="post-metadata">

**Author:** ![Michael\_Perzel](https://avatars.discourse-cdn.com/v4/letter/m/8491ac/32.png) [@Michael\_Perzel](https://forum.ansible.com/u/Michael_Perzel)\
**Post date:** [July 20, 2015, 6:57pm UTC](https://forum.ansible.com/t/service-now-dynamic-inventory/18730/3 "2015-07-20T18:57:20Z")

</div>

Thanks for sharing this has several improvements on mine. I hadn’t taken the time to implement a cache (our queries are really slow) or make the the query parameters generic.

---

<div class="post-metadata">

**Author:** ![Rohit\_Kothari](https://avatars.discourse-cdn.com/v4/letter/r/ccd318/32.png) [@Rohit\_Kothari](https://forum.ansible.com/u/Rohit_Kothari)\
**Post date:** [July 28, 2015, 6:58am UTC](https://forum.ansible.com/t/service-now-dynamic-inventory/18730/4 "2015-07-28T06:58:02Z")

</div>

Hello All,

As of July 27, 2015, please refer to this **updated** github link for ServiceNow dynamic inventory script:  
[https://github.com/juniper-it/ansible-modules-juniper-it/tree/master/inventory\_plugins](https://github.com/juniper-it/ansible-modules-juniper-it/tree/master/inventory_plugins)

Thanks,  
Rohit

---

<div class="post-metadata">

**Author:** ![Nicolas\_GOUZE](https://avatars.discourse-cdn.com/v4/letter/n/bc79bd/32.png) [@Nicolas\_GOUZE](https://forum.ansible.com/u/Nicolas_GOUZE)\
**Post date:** [March 11, 2016, 10:29am UTC](https://forum.ansible.com/t/service-now-dynamic-inventory/18730/5 "2016-03-11T10:29:40Z")

</div>

Hello Rohit,

The link you provide does not seem to be anymore available.  
Is it still available elsewhere ?

Nicolas

---

<div class="post-metadata">

**Author:** ![David\_Sastre\_Medina](https://avatars.discourse-cdn.com/v4/letter/d/43a26b/32.png) [@David\_Sastre\_Medina](https://forum.ansible.com/u/David_Sastre_Medina)\
**Post date:** [June 3, 2016, 1:25pm UTC](https://forum.ansible.com/t/service-now-dynamic-inventory/18730/6 "2016-06-03T13:25:04Z")

</div>

Nicolas,

I found a copy here:

[https://github.com/perzizzle/ansible-jnpr-modules/blob/master/inventory\_plugins/service\_now\_inventory.py](https://github.com/perzizzle/ansible-jnpr-modules/blob/master/inventory_plugins/service_now_inventory.py)

I haven’t tested if this still works with a current ServiceNow version, though.

Best regards.
