Task timeout

277 views
Skip to first unread message

s1mon...@gmail.com

unread,
Mar 4, 2021, 1:53:12 AM3/4/21
to Ansible Project

Hi,

I'm using the Check Point Ansible Mgmt Collection (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

Stefan Hornburg (Racke)

unread,
Mar 4, 2021, 7:26:47 AM3/4/21
to ansible...@googlegroups.com
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
Racke

>
> Regards,
>
> Simon
>
> --
> You received this message because you are subscribed to the Google Groups "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
> ansible-proje...@googlegroups.com <mailto:ansible-proje...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/6f058e2c-6b81-4cb3-bdb8-751bdeead3d3n%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/6f058e2c-6b81-4cb3-bdb8-751bdeead3d3n%40googlegroups.com?utm_medium=email&utm_source=footer>.


--
Ecommerce and Linux consulting + Perl and web application programming.
Debian and Sympa administration. Provisioning with Ansible.

OpenPGP_signature

J C

unread,
Mar 4, 2021, 9:16:49 AM3/4/21
to ansible...@googlegroups.com
I would try adding a var to the task.  Whatever number of seconds your task is expected to take.

vars:
ansible_command_timeout: ####

To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/63715d27-5412-7f94-c100-aec421eb4db2%40linuxia.de.

Brian Coca

unread,
Mar 4, 2021, 11:18:40 AM3/4/21
to Ansible Project
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.

----------
Brian Coca

s1mon...@gmail.com

unread,
Mar 4, 2021, 7:38:07 PM3/4/21
to Ansible Project
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

-------------------------------------------------------------------------------------------------------------------------

task path: /var/lib/awx/projects/checkpoint/cpviewdb_run.yml:7
<10.1.2.51> ESTABLISH LOCAL CONNECTION FOR USER: root
<10.1.2.51> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /root/.ansible/tmp/ansible-local-105715JthvxB `"&& mkdir /root/.ansible/tmp/ansible-local-105715JthvxB/ansible-tmp-1614902298.09-105833-95466278797556 && echo ansible-tmp-1614902298.09-105833-95466278797556="` echo /root/.ansible/tmp/ansible-local-105715JthvxB/ansible-tmp-1614902298.09-105833-95466278797556 `" ) && sleep 0'
Using module file /root/.ansible/collections/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_run_script.py
<10.1.2.51> PUT /root/.ansible/tmp/ansible-local-105715JthvxB/tmpnNzePL TO /root/.ansible/tmp/ansible-local-105715JthvxB/ansible-tmp-1614902298.09-105833-95466278797556/AnsiballZ_cp_mgmt_run_script.py
<10.1.2.51> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-local-105715JthvxB/ansible-tmp-1614902298.09-105833-95466278797556/ /root/.ansible/tmp/ansible-local-105715JthvxB/ansible-tmp-1614902298.09-105833-95466278797556/AnsiballZ_cp_mgmt_run_script.py && sleep 0'
<10.1.2.51> EXEC /bin/sh -c '/usr/bin/python /root/.ansible/tmp/ansible-local-105715JthvxB/ansible-tmp-1614902298.09-105833-95466278797556/AnsiballZ_cp_mgmt_run_script.py && sleep 0'
<10.1.2.51> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-local-105715JthvxB/ansible-tmp-1614902298.09-105833-95466278797556/ > /dev/null 2>&1 && sleep 0'
fatal: [10.1.2.51]: FAILED! => {
    "changed": false, 
    "invocation": {
        "module_args": {
            "args": null, 
            "comments": null, 
            "script": "/usr/tmp/scripts/cpviewdb/cpviewdb_exp_v2.sh", 
            "script_name": "cpviewdb export", 
            "targets": [
                "fw-1"
            ], 
            "version": null, 
            "wait_for_task": true
        }
    }, 
    "msg": "Task fw-cil-cluster.mgsops.fw - cpviewdb export with task id c2e0722e-a694-47a3-bdb0-6bc842bbd43b failed. Look at the logs for more details"
}

PLAY RECAP *****************************************************************************************************************************************************************************************************************************
10.1.2.51                  : ok=1    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0   

s1mon...@gmail.com

unread,
Mar 4, 2021, 8:00:57 PM3/4/21
to Ansible Project
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)]
Reply all
Reply to author
Forward
0 new messages