Is it possible to access Ansible tasks parameters from the Python module code?
Specifically, I would like to check if there is a register
on the task in order to return a more complete info set.
Is it possible to access Ansible tasks parameters from the Python module code?
Specifically, I would like to check if there is a register
on the task in order to return a more complete info set.
Yes, of course. You may have a look into Developing modules and Creating a module, in example
Please take note that Registering variables of the Return Values is done
This means the task, respective the module called within doesn't know about the fact if the output will become registered or not and since that is done after the execution of the module code and providing the final result.
Therefore you need to provide an other way of controlling the data structure of the result set.
In example
Or just introduce a separate parameter on your Custom Module like
or
which can be checked within the module and simply controls the verbosity of the result set.