# Need to know where we need to write the code for below thing -

**URL:** <https://forum.ansible.com/t/need-to-know-where-we-need-to-write-the-code-for-below-thing/24201>\
**Category:** Ansible Project\
**Created:** [April 12, 2017, 2:02pm UTC](https://forum.ansible.com/t/need-to-know-where-we-need-to-write-the-code-for-below-thing/24201 "2017-04-12T14:02:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nishant\_bawane](https://avatars.discourse-cdn.com/v4/letter/n/919ad9/32.png) [@nishant\_bawane](https://forum.ansible.com/u/nishant_bawane)\
**Post date:** [April 12, 2017, 2:02pm UTC](https://forum.ansible.com/t/need-to-know-where-we-need-to-write-the-code-for-below-thing/24201/1 "2017-04-12T14:02:37Z")

</div>

I know it is stupid question, but how can I use the beow code in my playbook . Do we need to use any command or shell for this ?

{% for host in groups[‘app\_servers’] %}  
{{ hostvars[host][‘ansible\_eth0’][‘ipv4’][‘address’] }}  
{% endfor %}

---

<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:** [April 13, 2017, 1:24am UTC](https://forum.ansible.com/t/need-to-know-where-we-need-to-write-the-code-for-below-thing/24201/2 "2017-04-13T01:24:14Z")

</div>

put it in a template and use template module? hard to answer with the  
context given.
