# How to run local play with remote inventory?

**URL:** <https://forum.ansible.com/t/how-to-run-local-play-with-remote-inventory/22388>\
**Category:** Ansible Project\
**Created:** [August 25, 2016, 5:49pm UTC](https://forum.ansible.com/t/how-to-run-local-play-with-remote-inventory/22388 "2016-08-25T17:49:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Daniel\_Q\_Miranda](https://avatars.discourse-cdn.com/v4/letter/d/a6a055/32.png) [@Daniel\_Q\_Miranda](https://forum.ansible.com/u/Daniel_Q_Miranda)\
**Post date:** [August 25, 2016, 5:49pm UTC](https://forum.ansible.com/t/how-to-run-local-play-with-remote-inventory/22388/1 "2016-08-25T17:49:50Z")

</div>

Greetings,

I’m using Ansible 2.1.1.0 to manage EC2 hosts, with the ec2.py inventory script.

I want to run a play locally that uses the EC2 inventory to generate configuration, but I’m having some trouble. If I use:

hosts: 127.0.0.1  
connection: local

I have to manually override the inventory, or the play won’t run due to having no hosts selected, but then I lose the EC2 inventory data.

Is there a good way to do this?

Regards,  
Daniel

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [February 10, 2017, 3:45am UTC](https://forum.ansible.com/t/how-to-run-local-play-with-remote-inventory/22388/2 "2017-02-10T03:45:31Z")

</div>

- hosts: all  
&nbsp;&nbsp;connection: local

^ the play will loop over the ec2 hosts but all actions will be on the  
controller, unless you have overrides in inventory.
