# EC2 script cache across inventories

**URL:** <https://forum.ansible.com/t/ec2-script-cache-across-inventories/17841>\
**Category:** Ansible Project\
**Created:** [March 25, 2015, 6:42pm UTC](https://forum.ansible.com/t/ec2-script-cache-across-inventories/17841 "2015-03-25T18:42:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gary\_Malouf](https://avatars.discourse-cdn.com/v4/letter/g/4bbf92/32.png) [@Gary\_Malouf](https://forum.ansible.com/u/Gary_Malouf)\
**Post date:** [March 25, 2015, 6:42pm UTC](https://forum.ansible.com/t/ec2-script-cache-across-inventories/17841/1 "2015-03-25T18:42:27Z")

</div>

We split our ec2 environment into separate vpcs and until now, have been deploying to each via our own laptops. (Limited to credentials root users, 2)

I ran into an issue today where I did the following:

ansible-playbook -i inventories/staging myawesomeplaybook.yml

\*Runs playbook on staging instances as expected

ansible-playbook -i inventories/production myawesomeplaybook.yml

!Runs playbook on staging instances when should actually be production

Clearing out the ec2 cache resulted in the correct behavior, but this seems like a very dangerous characteristic. Is there an idiomatic way of handling differing staging from production inventories in EC2?

---

<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:** [March 25, 2015, 7:17pm UTC](https://forum.ansible.com/t/ec2-script-cache-across-inventories/17841/2 "2015-03-25T19:17:53Z")

</div>

I would update the ec2.ini to use different cache directories.

cache\_path = ~/.ansible/tmp/ec2\_prod

---

<div class="post-metadata">

**Author:** ![Gary\_Malouf](https://avatars.discourse-cdn.com/v4/letter/g/4bbf92/32.png) [@Gary\_Malouf](https://forum.ansible.com/u/Gary_Malouf)\
**Post date:** [March 26, 2015, 12:39am UTC](https://forum.ansible.com/t/ec2-script-cache-across-inventories/17841/3 "2015-03-26T00:39:56Z")

</div>

Thanks, that worked great!
