How to run local play with remote inventory?

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

- hosts: all
  connection: local

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