Hi,
I have a playbook that uses a meta task to end the play for hosts not meeting a certain condition. Further along the playbook I have a run_once task that uses the ansible_play_hosts variable to provide a list of the hosts in the current play to a command.
My issue is that although I end the play for the hosts not meeting the required condition, they persist in the ansible_play_hosts variable - I guess this is expected since they are not failed and therefore still technically part of the play even though they will not have any further tasks executed against them. Is there any way of getting or creating a list of the hosts that remain active for the remaining tasks?
Here is a test playbook demonstrating that the play has ended for a particular host but remains in the play_hosts variable;
------ test_meta.yml ---------