Looking for a Way to Set a Global Task Timeout in Ansible

HI felixfontein,

Thanks for replying

With your suggestion i tried with TASK_TIMEOUT -

 cat /etc/ansible/ansible.cfg
# Since Ansible 2.12 (core):
# To generate an example config file (a "disabled" one with all default settings, commented out):
#               $ ansible-config init --disabled > ansible.cfg
#
# Also you can now have a more complete file by including existing plugins:
# ansible-config init --disabled -t all > ansible.cfg

# For previous versions of Ansible you can check for examples in the 'stable' branches of each version
# Note that this file was always incomplete  and lagging changes to configuration settings

# for example, for 2.9: https://github.com/ansible/ansible/blob/stable-2.9/examples/ansible.cfg
[defaults]
task_timeout=30

But it is not aborting the task even if it is running for more than 30sec.

TASK_TIMEOUT[]

Description:

Set the maximum time (in seconds) for a task action to execute in. Timeout runs independently from templating or looping. It applies per each attempt of executing the task’s action and remains unchanged by the total time spent on a task. When the action execution exceeds the timeout, Ansible interrupts the process. This is registered as a failure due to outside circumstances, not a task failure, to receive appropriate response and recovery process. If set to 0 (the default) there is no timeout.

Type:

integer

Default:

0

Version Added:

2.10

Ini:

Section:

[defaults]

Key:

task_timeout

Environment:

Variable:

[ANSIBLE_TASK_TIMEOUT]

The above i found out from ansible documentation and not able to get the result as expected.

TASK_TIMEOUT is not working as expected - Task timeout