# Task timeout

**URL:** <https://forum.ansible.com/t/task-timeout/34721>\
**Category:** Ansible Project\
**Tags:** galaxy-ng\
**Created:** [March 4, 2021, 6:53am UTC](https://forum.ansible.com/t/task-timeout/34721 "2021-03-04T06:53:12Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Simon\_Macpherson](https://avatars.discourse-cdn.com/v4/letter/s/ea666f/32.png) [@Simon\_Macpherson](https://forum.ansible.com/u/Simon_Macpherson)\
**Post date:** [March 4, 2021, 6:53am UTC](https://forum.ansible.com/t/task-timeout/34721/1 "2021-03-04T06:53:12Z")

</div>

Hi,

I’m using the Check Point Ansible Mgmt Collection ([https://galaxy.ansible.com/check\_point/mgmt](https://galaxy.ansible.com/check_point/mgmt))

Whilst running my playbook from the CLI, the run script task (check\_point.mgmt.cp\_mgmt\_run\_script) operation times out after 300 seconds and Ansible reports the task as failed.

The task continues to run in he background until completion.

Do you know which 300 second default timeout setting is causing this and where it can be modified?

Regards,

Simon

---

<div class="post-metadata">

**Author:** ![racke](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/racke/32/4767_2.png) [@racke](https://forum.ansible.com/u/racke)\
**Post date:** [March 4, 2021, 12:26pm UTC](https://forum.ansible.com/t/task-timeout/34721/2 "2021-03-04T12:26:22Z")

</div>

> Hi,
> 
> I'm using the Check Point Ansible Mgmt Collection ([https://galaxy.ansible.com/check\_point/mgmt](https://galaxy.ansible.com/check_point/mgmt))
> 
> Whilst running my playbook from the CLI, the run script task (check\_point.mgmt.cp\_mgmt\_run\_script) operation times out  
> after 300 seconds and Ansible reports the task as failed.
> 
> The task continues to run in he background until completion.
> 
> Do you know which 300 second default timeout setting is causing this and where it can be modified?

Hello Simon,

as far as I can tell there is no Ansible timeout for a task, so you need to look elsewhere for this timeout.

Which exact task in that collection is affected by the timeout?

Regards  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Racke

---

<div class="post-metadata">

**Author:** ![Jason](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/jason/32/304_2.png) [@Jason](https://forum.ansible.com/u/Jason)\
**Post date:** [March 4, 2021, 2:16pm UTC](https://forum.ansible.com/t/task-timeout/34721/3 "2021-03-04T14:16:20Z")

</div>

I would try adding a var to the task. Whatever number of seconds your task is expected to take.

| 

vars:

 |
| | 

ansible\_command\_timeout: ####

 |

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [March 4, 2021, 4:18pm UTC](https://forum.ansible.com/t/task-timeout/34721/4 "2021-03-04T16:18:04Z")

</div>

A generic task `timeout` keyword is added in 2.10.

There are 2 other timeouts, first affects connections and it relates to establishing one and/or reading from one.

The other is the ansible\_command\_timeout variable, which only works for specific networking modules and it is not ‘task wide’ but per command issued within the task.

---

<div class="post-metadata">

**Author:** ![Simon\_Macpherson](https://avatars.discourse-cdn.com/v4/letter/s/ea666f/32.png) [@Simon\_Macpherson](https://forum.ansible.com/u/Simon_Macpherson)\
**Post date:** [March 5, 2021, 12:38am UTC](https://forum.ansible.com/t/task-timeout/34721/5 "2021-03-05T00:38:07Z")

</div>

Hi

I’ve tried adding the following variable directly to the playbook but it’ still timing out after 300 seconds.

The task is running a bash shell script which is copying a file from one folder location to another locally, then sequentially connecting to two remote servers via SSH and copying the file to a file share on each of those servers.

Despite Ansible reporting the task as failed, the file copy process continues to run to completion in the background.

I need to rectify the 300 second task timeout as I intend to create schedules for these scripts in AWX so require a successful job run outcome.

Playbook and debug output of ansible-playbook below.

- hosts: all

connection: httpapi  
vars:  
ansible\_command\_timeout: 1000  
tasks:

- name: “copy cpviewdb”  
check\_point.mgmt.cp\_mgmt\_run\_script:  
script\_name: “cpviewdb export”  
script: /usr/tmp/scripts/cpviewdb/cpviewdb\_exp\_v2.sh  
targets:
- “fw-1”  
async: 1000  
poll: 10

---

<div class="post-metadata">

**Author:** ![Simon\_Macpherson](https://avatars.discourse-cdn.com/v4/letter/s/ea666f/32.png) [@Simon\_Macpherson](https://forum.ansible.com/u/Simon_Macpherson)\
**Post date:** [March 5, 2021, 1:00am UTC](https://forum.ansible.com/t/task-timeout/34721/6 "2021-03-05T01:00:57Z")

</div>

ansible 2.9.10  
config file = /etc/ansible/ansible.cfg  
configured module search path = [u’/root/.ansible/plugins/modules’, u’/usr/share/ansible/plugins/modules’]  
ansible python module location = /usr/lib/python2.7/site-packages/ansible  
executable location = /usr/bin/ansible  
python version = 2.7.5 (default, Sep 26 2019, 13:23:47) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]
