# collectively querying/combining results of the setup and ec2\_facts modules

**URL:** <https://forum.ansible.com/t/collectively-querying-combining-results-of-the-setup-and-ec2-facts-modules/16746>\
**Category:** Ansible Project\
**Created:** [November 11, 2014, 3:39pm UTC](https://forum.ansible.com/t/collectively-querying-combining-results-of-the-setup-and-ec2-facts-modules/16746 "2014-11-11T15:39:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![vaida.dan](https://avatars.discourse-cdn.com/v4/letter/v/5daacb/32.png) [@vaida.dan](https://forum.ansible.com/u/vaida.dan)\
**Post date:** [November 11, 2014, 3:39pm UTC](https://forum.ansible.com/t/collectively-querying-combining-results-of-the-setup-and-ec2-facts-modules/16746/1 "2014-11-11T15:39:00Z")

</div>

Greetings everyone!

For a given reason, I need to handle some Route53 records for my EC2’s EIPs.  
The instances are part of the [all] group in my hosts file.

Obviously, the ‘setup’ module is not aware of EIPs. But the ec2\_facts module is.

Right now, I’m trying to wrap my head around this design, although there will soon be a VPN tunnel that’s gonna simply render Ansible to interact with a Bind server, thus making this whole playbook obsolete, but nevertheless, something nice to have around.

I know I could probably achieve what I want with an external inventory tool like ec2.py but I want to see first if I can do it the “normal” way.

I only need to touch one zone in Route53, essentially by creating/updating an A record like so:

`

- name: updating Route53 records  
hosts: localhost  
connection: local  
gather\_facts: False  
tasks:

# if we have the records, replace them if they do not match. if we don’t have them, just create them.

- local\_action: route53 command=create [zone=domain.com](http://zone=domain.com) record={{ ??ansible\_hostname?? }}.zone.com type=A value={{ ??item.ansible\_ec2\_public\_ipv4?? }} overwrite=yes ttl=300  
with\_items: facts  
register: dnsrec\_update

- name: showing the results of the create task  
debug: var=dnsrec\_update

`

The above would be included by the following:

`

---

<div class="post-metadata">

**Author:** ![vaida.dan](https://avatars.discourse-cdn.com/v4/letter/v/5daacb/32.png) [@vaida.dan](https://forum.ansible.com/u/vaida.dan)\
**Post date:** [November 11, 2014, 3:45pm UTC](https://forum.ansible.com/t/collectively-querying-combining-results-of-the-setup-and-ec2-facts-modules/16746/2 "2014-11-11T15:45:53Z")

</div>

Never mind that erroneous include. It’s now properly aligned and Ansible doesn’t get surprised anymore by what I’m including 🙂
