Gather facts for one group to run playbook on another

29 views
Skip to first unread message

Paul Smith

unread,
Sep 5, 2014, 5:15:54 PM9/5/14
to ansible...@googlegroups.com
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

Michael DeHaan

unread,
Sep 5, 2014, 5:18:38 PM9/5/14
to ansible...@googlegroups.com
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.


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

Thanks!






--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/e1e827f4-2ef5-46e6-8c1e-8bce138eaf71%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages