# Facts Broken EC2 hostname Changed Format

**URL:** <https://forum.ansible.com/t/facts-broken-ec2-hostname-changed-format/14928>\
**Category:** Ansible Project\
**Tags:** ee\
**Created:** [April 2, 2014, 10:54pm UTC](https://forum.ansible.com/t/facts-broken-ec2-hostname-changed-format/14928 "2014-04-02T22:54:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Demetri\_Mouratis](https://avatars.discourse-cdn.com/v4/letter/d/f1d935/32.png) [@Demetri\_Mouratis](https://forum.ansible.com/u/Demetri_Mouratis)\
**Post date:** [April 2, 2014, 10:54pm UTC](https://forum.ansible.com/t/facts-broken-ec2-hostname-changed-format/14928/1 "2014-04-02T22:54:53Z")

</div>

I have been using Peter Sankauskas’s excellent netflixoss-ansible repo successfully for the past few months. Starting sometime yesterday, the ansible-playbook invocations started failing with the following error:

TASK: [base | Copy rc.local template] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*e  
127.0.0.1] =\> One or more undefined variables: ‘rc\_local\_path’ is undefined

I’m wrapping the whole build process in packer called by Jenkins, again which has been working a treat.

Packer does the following to invoke ansible:

sudo ansible-playbook /usr/local/netflixoss-ansible/playbooks/amp-iverson.yml --connection=local

So, I manually created a packer-builder ec2 node from a private AMI. When I logged in, I noticed the EC2 hostname had changed form form ip-w-x-y-z to domU-AA-BB-CC-DD-EE-FF.

e.g.:

domU-12-31-39-06-32-80

Suspicious.

This in turn may have caused some problems for the inventory file which I had been using, which looked like:

sudo sh -c ‘echo "127.0.0.1 ansible\_connection=local vm=0" \> /etc/ansible/hosts’

I cannot seem to get the following play to work successfully:

- name: Copy rc.local template

copy: src={{ ansible\_distribution }}/rc.local dest={{ rc\_local\_path }} owner=root group=root mode=0755

The vars are setup out of the top level playbook as such:

---

<div class="post-metadata">

**Author:** ![Demetri\_Mouratis](https://avatars.discourse-cdn.com/v4/letter/d/f1d935/32.png) [@Demetri\_Mouratis](https://forum.ansible.com/u/Demetri_Mouratis)\
**Post date:** [April 2, 2014, 11:12pm UTC](https://forum.ansible.com/t/facts-broken-ec2-hostname-changed-format/14928/2 "2014-04-02T23:12:58Z")

</div>

As is always the case, once I wrote out the problem I quickly found the solution.

Downgrading to ansible 1.5.3 from [https://launchpad.net/~rquillo/+archive/ansible](https://launchpad.net/~rquillo/+archive/ansible) fixes the issue. On the initial ansible play, I now see output from playbook saying it correctly interpolated the vars:

PLAY [Amp] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

GATHERING FACTS \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

ok: [domU-12-31-39-06-32-80]

domU-12-31-39-06-32-80: importing /usr/local/netflixoss-ansible/playbooks/vars/Ubuntu.yml

Carry on.

---

<div class="post-metadata">

**Author:** ![Demetri\_Mouratis](https://avatars.discourse-cdn.com/v4/letter/d/f1d935/32.png) [@Demetri\_Mouratis](https://forum.ansible.com/u/Demetri_Mouratis)\
**Post date:** [April 3, 2014, 12:12am UTC](https://forum.ansible.com/t/facts-broken-ec2-hostname-changed-format/14928/3 "2014-04-03T00:12:14Z")

</div>

Bug report: [https://github.com/ansible/ansible/issues/6832](https://github.com/ansible/ansible/issues/6832)

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [April 3, 2014, 10:09pm UTC](https://forum.ansible.com/t/facts-broken-ec2-hostname-changed-format/14928/4 "2014-04-03T22:09:39Z")

</div>

We’ve already replied to this one with a workaround for those that need it.

(The development branch also does not have this problem anymore)
