# ec2 facts from templates not rendering

**URL:** <https://forum.ansible.com/t/ec2-facts-from-templates-not-rendering/12842>\
**Category:** Ansible Project\
**Created:** [May 22, 2013, 12:04pm UTC](https://forum.ansible.com/t/ec2-facts-from-templates-not-rendering/12842 "2013-05-22T12:04:40Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nicolas\_G](https://avatars.discourse-cdn.com/v4/letter/n/a183cd/32.png) [@Nicolas\_G](https://forum.ansible.com/u/Nicolas_G)\
**Post date:** [May 22, 2013, 12:04pm UTC](https://forum.ansible.com/t/ec2-facts-from-templates-not-rendering/12842/1 "2013-05-22T12:04:40Z")

</div>

hi all,

I have a roles/common/templates/instance.properties.j2 fiel with the bellow contents :

HOSTNAME = {{ ansible\_fqdn }}  
PUBLIC\_IP = {{ ansible\_ec2\_public\_ipv4 }}  
PRIVATE\_IP = {{ ansible\_eth0.ipv4.address }}  
AVAIL\_ZONE = {{ ansible\_ec2\_placement\_availability\_zone }}  
server.id= {{ ansible\_ec2\_instance\_id }}

Unfortunately only the HOSTNAME and PRIVATE\_IP are rendering, the rest of the values are blank :

HOSTNAME = ip-10-34-149-173.eu-west-1.compute.internal  
PUBLIC\_IP =  
PRIVATE\_IP = 10.34.149.173  
AVAIL\_ZONE =  
server.id=

Any clue ?

---

<div class="post-metadata">

**Author:** ![Brian\_Coca1](https://avatars.discourse-cdn.com/v4/letter/b/278dde/32.png) [@Brian\_Coca1](https://forum.ansible.com/u/Brian_Coca1)\
**Post date:** [May 22, 2013, 12:07pm UTC](https://forum.ansible.com/t/ec2-facts-from-templates-not-rendering/12842/2 "2013-05-22T12:07:32Z")

</div>

What does the play look like?

Brian Coca

---

<div class="post-metadata">

**Author:** ![Nicolas\_G](https://avatars.discourse-cdn.com/v4/letter/n/a183cd/32.png) [@Nicolas\_G](https://forum.ansible.com/u/Nicolas_G)\
**Post date:** [May 22, 2013, 12:15pm UTC](https://forum.ansible.com/t/ec2-facts-from-templates-not-rendering/12842/3 "2013-05-22T12:15:52Z")

</div>

roles/common/tasks/main.yml :

---

<div class="post-metadata">

**Author:** ![Brian\_Coca1](https://avatars.discourse-cdn.com/v4/letter/b/278dde/32.png) [@Brian\_Coca1](https://forum.ansible.com/u/Brian_Coca1)\
**Post date:** [May 22, 2013, 12:31pm UTC](https://forum.ansible.com/t/ec2-facts-from-templates-not-rendering/12842/4 "2013-05-22T12:31:25Z")

</div>

That is just the role tasks, I was asking for the play so I could see your fact gathering

Brian Coca

---

<div class="post-metadata">

**Author:** ![Nicolas\_G](https://avatars.discourse-cdn.com/v4/letter/n/a183cd/32.png) [@Nicolas\_G](https://forum.ansible.com/u/Nicolas_G)\
**Post date:** [May 22, 2013, 12:41pm UTC](https://forum.ansible.com/t/ec2-facts-from-templates-not-rendering/12842/5 "2013-05-22T12:41:17Z")

</div>

isn’t the fact gathering enabled by default ?

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [May 22, 2013, 12:48pm UTC](https://forum.ansible.com/t/ec2-facts-from-templates-not-rendering/12842/6 "2013-05-22T12:48:40Z")

</div>

While generic Linux fact gathering is enabled by default, the ec2 fact module must be explicitly called.

---

<div class="post-metadata">

**Author:** ![Nicolas\_G](https://avatars.discourse-cdn.com/v4/letter/n/a183cd/32.png) [@Nicolas\_G](https://forum.ansible.com/u/Nicolas_G)\
**Post date:** [May 22, 2013, 1:18pm UTC](https://forum.ansible.com/t/ec2-facts-from-templates-not-rendering/12842/7 "2013-05-22T13:18:26Z")

</div>

cheers, it’s working now using :

```auto
- name: Gathering ec2 facts
  ec2_facts:

```

does the ec2 facts has any performance impact ?

---

<div class="post-metadata">

**Author:** ![Lester\_Wade](https://avatars.discourse-cdn.com/v4/letter/l/97f17d/32.png) [@Lester\_Wade](https://forum.ansible.com/u/Lester_Wade)\
**Post date:** [May 22, 2013, 1:36pm UTC](https://forum.ansible.com/t/ec2-facts-from-templates-not-rendering/12842/8 "2013-05-22T13:36:57Z")

</div>

How do you mean? Do you mean time to run? The ec2\_facts module runs on the instance to gather info from the metadata service and then returns this. If you have lots of hosts, it could of course take some time 🙂

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [May 22, 2013, 1:45pm UTC](https://forum.ansible.com/t/ec2-facts-from-templates-not-rendering/12842/9 "2013-05-22T13:45:13Z")

</div>

It should be negligible.

Parallelism can naturally be increased, along with everything else in ansible, by specifying a higher value for --forks.

This is true for all task types and not just this.
