I need to know the computed list of hosts in the constructor (i.e. the __init__method of my CallbackModule).
This should be all hosts currently limited, not necessarily which hosts will actually be called in any particular play (which may vary of course).
The earliest you can start to get info like that is during v2_playbook_on_play_start
__init__ is run during object instantiation, which happens before a playbook and play have been parsed. Since a play is where the hosts live, you will have to wait until that point.
Ah, I was starting to trace through Ansible but hadn’t found yet where the CallBack is instantiated.
v2_playbook_on_play_start receives an arg called “play”. That gives the list of nodes as their passed into the command line; i.e. names of groups are not broken out. I’d prefer to have a list of computed hosts at some point before v2_playbook_on_stats at the very end.