Created
September 29, 2016 09:37
-
-
Save tbondarchuk/e32a7296dda81438e56fff01d95d669b to your computer and use it in GitHub Desktop.
ansible gather facts from another host
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
## works only on ansible >= 2.0 | |
###### inventory: | |
# [group1] | |
# test-01 | |
# [group2] | |
# test-02 | |
- hosts: group2 | |
tasks: | |
- name: Gather facts | |
setup: | |
delegate_to: "{{ item }}" | |
delegate_facts: True | |
with_items: "{{ groups['group1'] }}" | |
- name: Show facts | |
debug: | |
msg: "{{ hostvars['test-01'] }}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Great job, thank you so much.