Return Value "results"

Hi everyone,

Bringing to the forum a conversation that started in this PR for community.general:

As you can read over there, @felixfontein raised the possibility of allowing this RV to be used freely by the modules. And I quote:

In any case, I would start a discussion on this on the forum. I think it’s also valid to adjust the description in https://docs.ansible.com/ansible/latest/reference_appendices/common_return_values.html#results to allow using results in regular return values.

I think that kinda makes sense, but it would probably make sense to change the “common RV” to something else, like loop_results.

We would like to hear from the community and the Ansible Core team about the problem and possible solutions.

I think it’s fine to use results for both. It is not really a ‘common return value’ in the sense that it is decribes a return value of an actual module, but the result of using loop (or with_*) together with a module - which has a very different structure from a normal module’s result.

Or do we have the assumption somewhere that results always means this is a loop result? If that’s the case, the sanity tests should be updated to prevent results showing up in documented return values for modules IMO.

I think it’s fine to use results for both too. Here’s an instance of that in ansible-core too: ansible/lib/ansible/modules/dnf5.py at devel · ansible/ansible · GitHub.

If it causes confusion, I think it would be less disruptive to rename the module return key instead of changing a common return value. The latter would break content using loop/with_ results regardless of whether they were even using a module that happens to also return results.