@ -2,6 +2,10 @@
- hosts : facthost1
- hosts : facthost1
gather_facts : no
gather_facts : no
tasks:
tasks:
- name : check that smart gathering is enabled
fail:
msg : 'smart gathering must be enabled'
when : 'lookup("env", "ANSIBLE_GATHERING") != "smart"'
- name : install test local facts
- name : install test local facts
copy:
copy:
src : uuid.fact
src : uuid.fact
@ -13,14 +17,14 @@
run_once : yes
run_once : yes
tasks:
tasks:
- block:
- block:
- name : 'Check the same host is used'
- name : 'Check the same host is used'
assert:
assert:
that : 'hostvars.facthost1.ansible_fqdn == hostvars.facthost2.ansible_fqdn'
that : 'hostvars.facthost1.ansible_fqdn == hostvars.facthost2.ansible_fqdn'
msg : 'This test requires 2 inventory hosts referring to the same host.'
msg : 'This test requires 2 inventory hosts referring to the same host.'
- name : "Check that run_once doesn't prevent fact gathering (#39453)"
- name : "Check that run_once doesn't prevent fact gathering (#39453)"
assert:
assert:
that : 'hostvars.facthost1.ansible_local.uuid != hostvars.facthost2.ansible_local.uuid'
that : 'hostvars.facthost1.ansible_local.uuid != hostvars.facthost2.ansible_local.uuid'
msg : "{{ 'Same value for ansible_local.uuid on both hosts: ' ~ hostvars.facthost1.ansible_local.uuid }}"
msg : "{{ 'Same value for ansible_local.uuid on both hosts: ' ~ hostvars.facthost1.ansible_local.uuid }}"
always:
always:
- name : remove test local facts
- name : remove test local facts
file:
file: