@ -815,7 +815,7 @@ class StrategyBase:
return ti_copy
def _load_included_file ( self , included_file : IncludedFile , iterator , is_handler = False , handle_stats_and_callbacks = True ):
def _load_included_file ( self , included_file : IncludedFile , iterator , is_handler = False ):
"""
Loads an included YAML file of tasks , applying the optional set of variables .
@ -823,15 +823,6 @@ class StrategyBase:
in such case the caller is responsible for marking the host ( s ) as failed
using PlayIterator . mark_host_failed ( ) .
"""
if handle_stats_and_callbacks :
display . deprecated (
msg = " Reporting play recap stats and running callbacks functionality for "
" ``include_tasks`` in ``StrategyBase._load_included_file`` is deprecated. "
" See ``https://github.com/ansible/ansible/pull/79260`` for guidance on how to "
" move the reporting into specific strategy plugins to account for "
" ``include_role`` tasks as well. " ,
version = " 2.21 " ,
)
display . debug ( " loading included file: %s " % included_file . _filename )
try :
data = self . _loader . load_from_file ( included_file . _filename , trusted_as_template = True )
@ -851,9 +842,6 @@ class StrategyBase:
loader = self . _loader ,
variable_manager = self . _variable_manager ,
)
if handle_stats_and_callbacks :
for host in included_file . _hosts :
self . _tqm . _stats . increment ( ' ok ' , host . name )
except AnsibleParserError :
raise
except AnsibleError as e :
@ -861,18 +849,8 @@ class StrategyBase:
reason = " Could not find or access ' %s ' on the Ansible Controller. " % to_text ( e . file_name )
else :
reason = to_text ( e )
if handle_stats_and_callbacks :
for tr in included_file . _results :
tr . _return_data [ ' failed ' ] = True
for host in included_file . _hosts :
tr = _RawTaskResult ( host = host , task = included_file . _task , return_data = dict ( failed = True , reason = reason ) , task_fields = { } )
self . _tqm . _stats . increment ( ' failures ' , host . name )
self . _tqm . send_callback ( ' v2_runner_on_failed ' , tr )
raise AnsibleError ( reason ) from e
if handle_stats_and_callbacks :
self . _tqm . send_callback ( ' v2_playbook_on_include ' , included_file )
display . debug ( " done processing included file " )
return block_list