Hi,
Been making good usage of smart fact gathering, as sometimes we have 30-40 plays grouped together and find that needing to gather facts for each one is a bit time consuming. We’ve been combining this with fact caching as we’ve some custom facts that are useful to be preserved between runs (I’ll use a different email to cover them as it might be something of interest to put together a better POC to be shared on why we doing that), so timeout is
But in turn, found that really we’d like to ensure that on the start of each run overall run, that the setup facts are refreshed.
For now just added an explicit call to ‘setup’ module at the various plays that would be run directly with a registered variable and when condition to skip running it again if it’s already been done during this execution run.
If didn’t have the custom facts that were useful to be preserved, the memory caching would have solved this, so I’m unsure if this is really a corner case or just that trying to do something at the current limits and we could improve things to cover this as well.
So I was thinking, that at the start of a series of combined plays the ‘smart’ behaviour with a fact store such as jsonfile or redis might be a tad more handy if it fact gathering had a ‘refresh’ mode as well?
So that can always be certain that the run starts with the latest facts from the system, but can benefit from the smart behaviour during the middle where we combine multiple plays rather than needing to be overly explicit with each play to skip gathering, and remember to switch the settings around someone moves code around to add a different play at the start (people forget…).
With the general refactoring for V2, it seems like this would be trivial, and I will probably have a PR for it shortly, but thought I’d start getting used to discussing things on the mailing list anyway as it’s probably easier for questions to be asked/answered here and reference that in the PR.
(btw, it looks like a two line change to add support for this)