Skip to content

Instantly share code, notes, and snippets.

@samdoran
Last active June 19, 2017 22:29
Show Gist options
  • Save samdoran/39ab968bb9c2f485d08f53ae9722dcf5 to your computer and use it in GitHub Desktop.
Save samdoran/39ab968bb9c2f485d08f53ae9722dcf5 to your computer and use it in GitHub Desktop.
Test fact delegation
[lab]
lab-1 ansible_host=10.77.1.11
lab-2 ansible_host=10.77.2.11
lab-3 ansible_host=10.77.3.11
- name: Test fact delegation
hosts: localhost
connection: local
gather_facts: no
become: no
tasks:
- name: Set some facts
set_fact:
testfact: "{{ item }}"
delegate_to: "{{ item }}"
delegate_facts: yes
with_items: "{{ groups.lab }}"
- name: Verify the facts are set
gather_facts: yes
hosts: lab
tasks:
- name: Print out facts
debug:
var: testfact
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment