callback to early to ask for information?

Hi,

Callback functions are something new to Ansible. I first need to look up what a callback function was. So, I think I’m not alone with my stupid questions :slight_smile:

On git we find 2 callback programs.

  • log_plays.py

  • osx_say.py

  • Are those functions executed at the ansible server or at the host where the playbook is running on? I think at the server.

  • There are nearly 20 callback functions. It’s not very clear when a callback function is executed. ex. “playbook_on_stats”? Some are run 1 time and other multiple times?

  • There is no callback “playbook_on_finish”?

  • If we have multiple callback programs, in which order would they get executed.? Alphabetic order? This means that the callback function “runner_on_ok” defined in the program “log_plays.py” would be executed first and then in “osx_say.py”?

Probably, Im too early to ask these questions and I need to wait for an update of the documentation.

Thx,
Gerrit

Hi,

Callback functions are something new to Ansible. I first need to look up what a callback function was. So, I think I’m not alone with my stupid questions :slight_smile:

On git we find 2 callback programs.

  • log_plays.py

  • osx_say.py

  • Are those functions executed at the ansible server or at the host where the playbook is running on? I think at the server.

overlord/server, yes.

  • There are nearly 20 callback functions. It’s not very clear when a callback function is executed. ex. “playbook_on_stats”? Some are run 1 time and other multiple times?

grep through the code, it will become more clear, but the answer is this happens when all plays are finished, and only then.

and yes, absolutely.

  • There is no callback “playbook_on_finish”?

patches accepted, but there’s no “playbook on start” either. You’d want to add both. Right now, there is a callback on starting each play. Be sure to update noop.py if you add any so
it can serve as documentation – but callback modules do not have to implement all functions, if a function is not found in a callback, it will not complain. Thus they are reasonably future
proof.

  • If we have multiple callback programs, in which order would they get executed.? Alphabetic order? This means that the callback function “runner_on_ok” defined in the program “log_plays.py” would be executed first and then in “osx_say.py”?

I think it’s just glob.glob now, so that should be alphabetical. An explicit sort can’t hurt.

Probably, Im too early to ask these questions and I need to wait for an update of the documentation.

It’s ok. Good questions. noop.py needs a few more comments for sure. I’ll take care of that eventually (nobody submit a patch for that, I’m apt to be picky).