@Brian Coca
I have already tried to set *gathering=smart* in ansible.cfg or *export
ANSIBLE_GATHERING=smart*
Nothing happens during the second play run when the *fact_caching_timeout*
expires after the first one.
Anyway, even if it worked, there would be a major drawback: its
*unpredictability*.
For instance, let's assume:
- *fact_caching_timeout* expires after the first play run
- one of the *ansible_facts* is used at the beginning of the second run
to perform a *group_by* with *ansible_net_version* for instance
Even if the smart feature works and kicks in after the second run begins,
there is a high probability that the playbook will fail due to
*ansible_net_version
*being undefined, depending on when exactly it does kick in and how long it
takes to retrieve the data from the remote device.
On top of that, there is no way to run a module to gather facts when that
variable is undefined, because there is no *setup* equivalence in the
networking ecosystem.
IIUC, when *gather_facts: yes* is used, it launches the correct
platform-dependent gathering facts module based on the value of predefined
*ansible_network_os*. And there is not a single umbrella module to take
care of that logic.
Hence my initial wrong belief that *gather_facts: yes* would first check if
the *fact_caching_timeout *is about to expire (for instance halfway
through the timeout) before deciding whether to gather facts from the remote
device or not. With that type of logic, we could count on the fact that
after that call, the *ansible_facts *would be accessible for sure*.*
*As a summary:*
- the smart feature does not work over networking devices
- even if it did, it would be:
- unpredictable
- unusable in some use cases where a gather_facts should be
avoided unless absolutely necessary
*Workaround*:
- *gathering = explicit*
- run a background playbook every halfway through the* fact_caching_timeout
*for all remote devices
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/06eba760-6e31-4630-be9c-a1e83b5986d3n%40googlegroups.com.