From 7b03ebf939259710b44092cc780e5f02374dcab9 Mon Sep 17 00:00:00 2001 From: Abhijeet Kasurde Date: Wed, 28 Apr 2021 18:23:36 +0530 Subject: [PATCH] setup: Add note and example of delegated facts (#74479) * Added a note about 'delegated_facts' * Added an example of 'delegated_facts' Fixes: #67067 Signed-off-by: Abhijeet Kasurde --- lib/ansible/modules/setup.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/ansible/modules/setup.py b/lib/ansible/modules/setup.py index 0b7fad9f890..13a7fd64d2f 100644 --- a/lib/ansible/modules/setup.py +++ b/lib/ansible/modules/setup.py @@ -87,6 +87,8 @@ notes: - This module is also supported for Windows targets. - This module should be run with elevated privileges on BSD systems to gather facts like ansible_product_version. - Supports C(check_mode). + - For more information about delegated facts, + please check U(https://docs.ansible.com/ansible/latest/user_guide/playbooks_delegation.html#delegating-facts). author: - "Ansible Core Team" - "Michael DeHaan" @@ -139,6 +141,15 @@ EXAMPLES = """ # Display facts from Windows hosts with custom facts stored in C(C:\\custom_facts). # ansible windows -m ansible.builtin.setup -a "fact_path='c:\\custom_facts'" + +# Gathers facts for the machines in the dbservers group (a.k.a Delegating facts) +- hosts: app_servers + tasks: + - name: Gather facts from db servers + ansible.builtin.setup: + delegate_to: "{{ item }}" + delegate_facts: true + loop: "{{ groups['dbservers'] }}" """ # import module snippets