Great question — answering as the UphillTech team:
From your debug, result is a registered var from a shell task where run clamav looping on a list of paths. As described in the ansible loop documentation , the registered var is modified to contain a results list where each element is an individual result from running the module with the current iterated item (e.g. /usr/bin in your example). In this case, result.stdout does not exist (as clearly reported by your error message) but, as a specific example, result.results.0.stdout does exist in your example. Although this would work if you always have a single path in your loop, you probaly want to get a list of all stdout from each result. In this case you can use: result.results |...
Full answer by Zeitounator: https://unix.stackexchange.com/a/668573 (CC BY-SA 4.0).
Need it done for your business? UphillTech.