# Ansible without inventory?

**URL:** <https://forum.ansible.com/t/ansible-without-inventory/13693>\
**Category:** Ansible Project\
**Created:** [October 16, 2013, 3:47pm UTC](https://forum.ansible.com/t/ansible-without-inventory/13693 "2013-10-16T15:47:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matthew\_Bradley](https://avatars.discourse-cdn.com/v4/letter/m/41988e/32.png) [@Matthew\_Bradley](https://forum.ansible.com/u/Matthew_Bradley)\
**Post date:** [October 16, 2013, 3:47pm UTC](https://forum.ansible.com/t/ansible-without-inventory/13693/1 "2013-10-16T15:47:39Z")

</div>

How do I run Ansible without inventory? I want my playbook to provision a new Digital Ocean droplet and then write its details to a local inventory file. However every time I run my playbook with an empty hosts file it complains, stating “ERROR: provided hosts list is empty”

Am I trying to do something that isn’t possible with Ansible?

Thanks,

Matt

---

<div class="post-metadata">

**Author:** ![Brian\_Coca1](https://avatars.discourse-cdn.com/v4/letter/b/278dde/32.png) [@Brian\_Coca1](https://forum.ansible.com/u/Brian_Coca1)\
**Post date:** [October 16, 2013, 7:43pm UTC](https://forum.ansible.com/t/ansible-without-inventory/13693/2 "2013-10-16T19:43:52Z")

</div>

I would suggest you read:  
[http://www.ansibleworks.com/docs/guide\_aws.html](http://www.ansibleworks.com/docs/guide_aws.html)

if you want to avoid writing the initial localhost you can always pass -i ‘localhost,’ to the ansible command (trailing comma is intentional and needed).

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [October 16, 2013, 7:50pm UTC](https://forum.ansible.com/t/ansible-without-inventory/13693/3 "2013-10-16T19:50:02Z")

</div>

Yeah the trailing comma is a hack, we should not suggest it in most cases.

---

<div class="post-metadata">

**Author:** ![Sankalp\_Khare](https://avatars.discourse-cdn.com/v4/letter/s/f1d935/32.png) [@Sankalp\_Khare](https://forum.ansible.com/u/Sankalp_Khare)\
**Post date:** [September 23, 2014, 11:19pm UTC](https://forum.ansible.com/t/ansible-without-inventory/13693/4 "2014-09-23T23:19:39Z")

</div>

Be that as it may, i’ve found this tip invaluable in quickly applying chosen roles to a few servers / test servers.
