dynamic inventory jinja2 template help

49 views
Skip to first unread message

Bryan Pearson

unread,
Aug 3, 2016, 1:51:57 PM8/3/16
to Ansible Project
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

Alexey Vazhnov

unread,
Aug 5, 2016, 4:43:43 AM8/5/16
to Ansible Project
Try something like this https://github.com/f500/ansible-dumpall to understand what you have.
Reply all
Reply to author
Forward
0 new messages