# Is it possible to generate Inventory from CMDB (Configuration Management Database)

**URL:** <https://forum.ansible.com/t/is-it-possible-to-generate-inventory-from-cmdb-configuration-management-database/21751>\
**Category:** Ansible Project\
**Created:** [June 13, 2016, 2:31pm UTC](https://forum.ansible.com/t/is-it-possible-to-generate-inventory-from-cmdb-configuration-management-database/21751 "2016-06-13T14:31:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Raghava\_Krishna](https://avatars.discourse-cdn.com/v4/letter/r/3ab097/32.png) [@Raghava\_Krishna](https://forum.ansible.com/u/Raghava_Krishna)\
**Post date:** [June 13, 2016, 2:31pm UTC](https://forum.ansible.com/t/is-it-possible-to-generate-inventory-from-cmdb-configuration-management-database/21751/1 "2016-06-13T14:31:10Z")

</div>

> I’am planning to generate dynamic inventory file from configuration management database system instead of writing in files. Is it possible to write a script,so that when i run ansible playbook it should pick up inventory from database.  
> If it is successful then i have a plan of generating the variables from database itself.  
>   
>   
> |

---

<div class="post-metadata">

**Author:** ![Greg\_DeKoenigsberg1](https://avatars.discourse-cdn.com/v4/letter/g/838e76/32.png) [@Greg\_DeKoenigsberg1](https://forum.ansible.com/u/Greg_DeKoenigsberg1)\
**Post date:** [June 13, 2016, 2:41pm UTC](https://forum.ansible.com/t/is-it-possible-to-generate-inventory-from-cmdb-configuration-management-database/21751/2 "2016-06-13T14:41:23Z")

</div>

> I'am planning to generate dynamic inventory file from configuration  
> management database system instead of writing in files. Is it possible to  
> write a script,so that when i run ansible playbook it should pick up  
> inventory from database.  
> If it is successful then i have a plan of generating the variables from  
> database itself.

Yes. Just make a script that queries your CMDB and returns output in JSON  
format, and that's your dynamic inventory script.

[http://docs.ansible.com/ansible/developing\_inventory.html](http://docs.ansible.com/ansible/developing_inventory.html)
