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 <akasurde@redhat.com>
This commit is contained in:
parent
f194108a26
commit
7b03ebf939
1 changed files with 11 additions and 0 deletions
|
@ -87,6 +87,8 @@ notes:
|
||||||
- This module is also supported for Windows targets.
|
- 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.
|
- This module should be run with elevated privileges on BSD systems to gather facts like ansible_product_version.
|
||||||
- Supports C(check_mode).
|
- 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:
|
author:
|
||||||
- "Ansible Core Team"
|
- "Ansible Core Team"
|
||||||
- "Michael DeHaan"
|
- "Michael DeHaan"
|
||||||
|
@ -139,6 +141,15 @@ EXAMPLES = """
|
||||||
|
|
||||||
# Display facts from Windows hosts with custom facts stored in C(C:\\custom_facts).
|
# 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'"
|
# 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
|
# import module snippets
|
||||||
|
|
Loading…
Reference in a new issue