# OpenStack Dynamic Inventory Question

**URL:** <https://forum.ansible.com/t/openstack-dynamic-inventory-question/20816>\
**Category:** Ansible Project\
**Created:** [March 9, 2016, 8:16pm UTC](https://forum.ansible.com/t/openstack-dynamic-inventory-question/20816 "2016-03-09T20:16:44Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mike\_Albert](https://avatars.discourse-cdn.com/v4/letter/m/b5e925/32.png) [@Mike\_Albert](https://forum.ansible.com/u/Mike_Albert)\
**Post date:** [March 9, 2016, 8:16pm UTC](https://forum.ansible.com/t/openstack-dynamic-inventory-question/20816/1 "2016-03-09T20:16:44Z")

</div>

Hi,

I’m trying to configure OpenStack dynamic inventory with Ansible, but I keep getting the following error:

mikealbert@rmbp lab (master) $ ./openstack.py --list  
Error fetching server list on envvars:Region1:

I’ve defined the variables below in my .bash\_profile and I’ve confirmed that “nova list” returns results

OS\_REGION\_NAME  
OS\_PASSWORD  
OS\_AUTH\_URL  
OS\_USERNAME  
OS\_TENANT\_NAME

Not sure if it makes a difference but I’m running Ansible 2.0.1.0.

---

<div class="post-metadata">

**Author:** ![Tim1](https://avatars.discourse-cdn.com/v4/letter/t/b782af/32.png) [@Tim1](https://forum.ansible.com/u/Tim1)\
**Post date:** [March 9, 2016, 8:43pm UTC](https://forum.ansible.com/t/openstack-dynamic-inventory-question/20816/2 "2016-03-09T20:43:35Z")

</div>

I’m also getting this error. Maybe something in shade or os-client-config changed? Maybe Monty knows?

-tim

---

<div class="post-metadata">

**Author:** ![Mike\_Albert](https://avatars.discourse-cdn.com/v4/letter/m/b5e925/32.png) [@Mike\_Albert](https://forum.ansible.com/u/Mike_Albert)\
**Post date:** [March 9, 2016, 9:12pm UTC](https://forum.ansible.com/t/openstack-dynamic-inventory-question/20816/3 "2016-03-09T21:12:53Z")

</div>

Here’s what I’m running locally.

ansible==2.0.1.0  
os-client-config==1.16.0  
shade==1.4.0

---

<div class="post-metadata">

**Author:** ![Mike\_Albert](https://avatars.discourse-cdn.com/v4/letter/m/b5e925/32.png) [@Mike\_Albert](https://forum.ansible.com/u/Mike_Albert)\
**Post date:** [March 10, 2016, 5:49pm UTC](https://forum.ansible.com/t/openstack-dynamic-inventory-question/20816/4 "2016-03-10T17:49:57Z")

</div>

I updated to shade 1.5.1 and it resolved this issue.

---

<div class="post-metadata">

**Author:** ![Mike\_Albert](https://avatars.discourse-cdn.com/v4/letter/m/b5e925/32.png) [@Mike\_Albert](https://forum.ansible.com/u/Mike_Albert)\
**Post date:** [March 18, 2016, 1:42pm UTC](https://forum.ansible.com/t/openstack-dynamic-inventory-question/20816/5 "2016-03-18T13:42:55Z")

</div>

I thought upgrading to shade 1.5.1 resolved our inventory issue but on second glance, openstack.py --list is not returning all the compute instances in our environment.

We tested the old openstack dynamic inventory script ([https://github.com/ansible/ansible/blob/devel/contrib/inventory/nova.py](https://github.com/ansible/ansible/blob/devel/contrib/inventory/nova.py)) and that script works correctly.

Is anyone else having dynamic inventory issues with Ansible 2.0 and the new openstack.py inventory script?

---

<div class="post-metadata">

**Author:** ![Monty\_Taylor](https://avatars.discourse-cdn.com/v4/letter/m/7993a0/32.png) [@Monty\_Taylor](https://forum.ansible.com/u/Monty_Taylor)\
**Post date:** [March 18, 2016, 7:37pm UTC](https://forum.ansible.com/t/openstack-dynamic-inventory-question/20816/6 "2016-03-18T19:37:07Z")

</div>

There are two things you should try to help us track down the problem, if you don’t mind.

First of all:

openstack server list

(python-openstackclient also uses occ, so that should let us know that the config is working right)

If that works and you see the servers, my _hunch_ is that ansible cannot figure out the interface\_ip of your server, which means our introspection code is making an assumption. So if you can try making a copy of openstack.py and editing it - find this:

if ‘interface\_ip’ not in server:  
continue

and delete it

If openstack.py --list _works_ at that point, I’d really love if you’d be kind enough to send me a copy of the output of at least one of the servers so I can see what’s going on with your addresses list. (there should be nothing in the output that would be compromosing, but you migth want to scan it - feel free to send the entire output or just one server. OR - if you don’t want to do that, I can cook up some more code snippets for you to try to diagnose further.

thanks!

---

<div class="post-metadata">

**Author:** ![Mike\_Albert](https://avatars.discourse-cdn.com/v4/letter/m/b5e925/32.png) [@Mike\_Albert](https://forum.ansible.com/u/Mike_Albert)\
**Post date:** [March 29, 2016, 7:03pm UTC](https://forum.ansible.com/t/openstack-dynamic-inventory-question/20816/7 "2016-03-29T19:03:55Z")

</div>

Sorry about the delay in responding.

Just to add a bit more info, we are actually using an external service which provides an openstack layer on top of our vmware infrastructure. While working with that vendor, they found that the dynamic inventory script for openstack assumes neutron networking when they were actually using nova networking. Their dev team provided a modified script to us, and we are now able to query the inventory successfully.
