# ec2 host variables lost with refresh\_inventory

**URL:** <https://forum.ansible.com/t/ec2-host-variables-lost-with-refresh-inventory/21796>\
**Category:** Ansible Project\
**Created:** [June 16, 2016, 8:05pm UTC](https://forum.ansible.com/t/ec2-host-variables-lost-with-refresh-inventory/21796 "2016-06-16T20:05:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jeff\_Hardy](https://avatars.discourse-cdn.com/v4/letter/j/ecae2f/32.png) [@Jeff\_Hardy](https://forum.ansible.com/u/Jeff_Hardy)\
**Post date:** [June 16, 2016, 8:05pm UTC](https://forum.ansible.com/t/ec2-host-variables-lost-with-refresh-inventory/21796/1 "2016-06-16T20:05:08Z")

</div>

Hello all,

I have been working with a few different patterns for launching and configuring ec2 hosts, first with add\_host, and more recently working with refresh\_inventory. The problem I am having is that all ec2\_ host variables are lost with the introduction of the refresh\_inventory task. Sample playbook:

---

<div class="post-metadata">

**Author:** ![Barry\_Kaplan](https://avatars.discourse-cdn.com/v4/letter/b/48db29/32.png) [@Barry\_Kaplan](https://forum.ansible.com/u/Barry_Kaplan)\
**Post date:** [June 22, 2016, 5:46am UTC](https://forum.ansible.com/t/ec2-host-variables-lost-with-refresh-inventory/21796/2 "2016-06-22T05:46:58Z")

</div>

I am seeing similar behavior with 2.1. If I use refresh\_inventory some of the hosts are removed and plays subsequently fail.

---

<div class="post-metadata">

**Author:** ![Jeff\_Hardy](https://avatars.discourse-cdn.com/v4/letter/j/ecae2f/32.png) [@Jeff\_Hardy](https://forum.ansible.com/u/Jeff_Hardy)\
**Post date:** [June 23, 2016, 1:26am UTC](https://forum.ansible.com/t/ec2-host-variables-lost-with-refresh-inventory/21796/3 "2016-06-23T01:26:03Z")

</div>

I should have indicated, I see the same with both 2.0.2 and 2.1.0. When I first ran into the issue, the only thing I found related was [https://github.com/ansible/ansible/issues/15115](https://github.com/ansible/ansible/issues/15115), which does not seem to be the same problem.
