# Gather facts for one group to run playbook on another

**URL:** <https://forum.ansible.com/t/gather-facts-for-one-group-to-run-playbook-on-another/16131>\
**Category:** Ansible Project\
**Created:** [September 5, 2014, 9:15pm UTC](https://forum.ansible.com/t/gather-facts-for-one-group-to-run-playbook-on-another/16131 "2014-09-05T21:15:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Paul\_Smith](https://avatars.discourse-cdn.com/v4/letter/p/8c91f0/32.png) [@Paul\_Smith](https://forum.ansible.com/u/Paul_Smith)\
**Post date:** [September 5, 2014, 9:15pm UTC](https://forum.ansible.com/t/gather-facts-for-one-group-to-run-playbook-on-another/16131/1 "2014-09-05T21:15:54Z")

</div>

I’d like to gather facts from one group of servers for running a playbook on another group. Crucially, I don’t want to run tasks on the first group, just the fact-gathering.

For example, I want to run a playbook for a group of app servers, which needs the facts of the database servers group for database IP addresses.

-Paul  
@paulsmith  
[pauladamsmith.com](http://pauladamsmith.com)

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [September 5, 2014, 9:18pm UTC](https://forum.ansible.com/t/gather-facts-for-one-group-to-run-playbook-on-another/16131/2 "2014-09-05T21:18:31Z")

</div>

Hi Paul,

The trick is to either (A) have a playbook that talks to both groups like so:

- hosts: onegroup  
tasks: 

- hosts: othergroup  
tasks:

- …

Or (B), if using 1.8, enable “fact caching” and gather facts on onegroup and then have your other play use that cache.

[http://docs.ansible.com/playbooks\_variables.html#fact-caching](http://docs.ansible.com/playbooks_variables.html#fact-caching)

Let me know if this helps or you have further questions!

Thanks!
