# dynamic inventory jinja2 template help

**URL:** <https://forum.ansible.com/t/dynamic-inventory-jinja2-template-help/22197>\
**Category:** Ansible Project\
**Tags:** aws\
**Created:** [August 3, 2016, 2:58am UTC](https://forum.ansible.com/t/dynamic-inventory-jinja2-template-help/22197 "2016-08-03T02:58:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bryan\_Pearson](https://avatars.discourse-cdn.com/v4/letter/b/9f8e36/32.png) [@Bryan\_Pearson](https://forum.ansible.com/u/Bryan_Pearson)\
**Post date:** [August 3, 2016, 2:58am UTC](https://forum.ansible.com/t/dynamic-inventory-jinja2-template-help/22197/1 "2016-08-03T02:58:47Z")

</div>

I have nodes in AWS and I’d like to use the dynamic inventory to create a template. Currently I cant get the facts from all the nodes into the one template file. The template only gets populated with the node thats in “role deploy” and doesnt include the monitor group.

playbook ---------

- name: Gather facts  
ec2\_remote\_facts:  
ec2\_region: us-east-1  
filters:  
instance-state-name: running  
“tag:Role”: monitor  
become: false  
register: ec2

- name: Deploy host template  
template: src=filename dest=filename  
when: “‘tag\_Role\_deploy’ in group\_names”

jinja2 template-------------

{% for host in groups[‘tag\_Name\_monitor’] %}

{{ host }}

{% endfor %}

Thanks

---

<div class="post-metadata">

**Author:** ![alexey.vazhnov](https://avatars.discourse-cdn.com/v4/letter/a/b487fb/32.png) [@alexey.vazhnov](https://forum.ansible.com/u/alexey.vazhnov)\
**Post date:** [August 5, 2016, 8:43am UTC](https://forum.ansible.com/t/dynamic-inventory-jinja2-template-help/22197/2 "2016-08-05T08:43:43Z")

</div>

Try something like this [https://github.com/f500/ansible-dumpall](https://github.com/f500/ansible-dumpall) to understand what you have.
