# Digital ocean dynamic inventory - just plain old barely works

**URL:** <https://forum.ansible.com/t/digital-ocean-dynamic-inventory-just-plain-old-barely-works/17453>\
**Category:** Ansible Project\
**Created:** [February 5, 2015, 6:02am UTC](https://forum.ansible.com/t/digital-ocean-dynamic-inventory-just-plain-old-barely-works/17453 "2015-02-05T06:02:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ryan\_Rawson](https://avatars.discourse-cdn.com/v4/letter/r/dbc845/32.png) [@Ryan\_Rawson](https://forum.ansible.com/u/Ryan_Rawson)\
**Post date:** [February 5, 2015, 6:02am UTC](https://forum.ansible.com/t/digital-ocean-dynamic-inventory-just-plain-old-barely-works/17453/1 "2015-02-05T06:02:02Z")

</div>

So I am doing a digital ocean thing. I saw the dynamic inventory scripts and thought my problems were solved. But turns out, it only covers the simplest case and doesn’t help you further.

The background here is I’m doing a little bit of a hbase thing. So I have created some hosts using the digital ocean commands, but first I had to fix the private networking bug ([https://github.com/ansible/ansible-modules-core/pull/677](https://github.com/ansible/ansible-modules-core/pull/677))

So I create my hosts with a standalone playbook:

---

<div class="post-metadata">

**Author:** ![Shawn\_Adams](https://avatars.discourse-cdn.com/v4/letter/s/439d5e/32.png) [@Shawn\_Adams](https://forum.ansible.com/u/Shawn_Adams)\
**Post date:** [February 18, 2015, 7:51pm UTC](https://forum.ansible.com/t/digital-ocean-dynamic-inventory-just-plain-old-barely-works/17453/2 "2015-02-18T19:51:37Z")

</div>

Ryan,

I am facing the same issue as you. In your case you can actually reference your hosts from a play like this :

_hosts: hbase0:hbase1:hbase2 (and so on)_

Which is not ideal but it does “work”. In my case I need to create servers in DO and I need to reference them with groups like “prod” and “prod-appname”. The solution I came up with involves making changes to the **digital\_ocean.py** inventory script. The changes were quite simple and you can follow a similar approach.

See here [https://gist.github.com/boris317/5fc7bf6d003c7df3ae74](https://gist.github.com/boris317/5fc7bf6d003c7df3ae74)

In your case you would do something like this:

_if the droplet[‘name’].startswith(‘hbase’):_  
_self.push(self.inventory, “hbase”, dest)_
