Dynamic callback

Hey,

Is it possible to have play set a callback or that has to be done before the execution ?

Ansible callbacks are not set by plays, they are loaded by being in the callback path prior to starting.

The path callbacks are searched for in is determined by ansible.cfg.

I think it may be interesting to discuss your fuctional use case as there may be a better way to achieve what you are looking for?

Thats what i do at the moment, but the idea is to set callback based on some variable that will then selectively enable callback or not during the execution of a play. So for examples on development deployment we do not need callback functionality on production we might need or while debugging.

I have not digged into the code but i think the hooks are done before execution and might make my request hard to achieve easily.

“but the idea is to set callback based on some variable that will then selectively enable callback or not during the execution of a play”

You could do some checks in the body of the callback functions that make the callbacks a no-op.