<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: cp_mgmt_run_script module 5 minute runtime timeout in Ansible</title>
    <link>https://community.checkpoint.com/t5/Ansible/cp-mgmt-run-script-module-5-minute-runtime-timeout/m-p/119845#M550</link>
    <description>&lt;P&gt;As I suggested: using nohup.&lt;BR /&gt;More precisely, invoke whatever script has your commands with nohup (e.g. /usr/bin/nohup /home/admin/whateverscript.sh)&lt;BR /&gt;This will run the script in the background and pipe output to nohup.out.&lt;/P&gt;</description>
    <pubDate>Mon, 31 May 2021 02:36:22 GMT</pubDate>
    <dc:creator>PhoneBoy</dc:creator>
    <dc:date>2021-05-31T02:36:22Z</dc:date>
    <item>
      <title>cp_mgmt_run_script module 5 minute runtime timeout</title>
      <link>https://community.checkpoint.com/t5/Ansible/cp-mgmt-run-script-module-5-minute-runtime-timeout/m-p/119643#M547</link>
      <description>&lt;P&gt;&lt;SPAN&gt;The following appears to be a limitation with the checkpoint API run-script endpoint. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I have opened an RFE with Checkpoint for this but no ETA.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;This may be related to &lt;STRONG&gt;sk160753&lt;/STRONG&gt; which is a known limitation that has existed since R80.10.&lt;/P&gt;&lt;P&gt;PRHF-14607 :&lt;/P&gt;&lt;P&gt;"Running a one time script on a Security Gateway (that reads files or outputs of commands) using a "One Time Script" feature in SmartConsole or with API may fail after 5 minutes with the "Operation timed out" error.&lt;BR /&gt;The limit for reading files is 9,730 lines or 730 KB (whichever is reached first)."&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Do you know of a workaround that will allow me to run a script that has a runtime duration of 300 seconds or greater?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;-------------------------------------------------------------------------------------------------------------------------------------&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Whilst running a playbook from the command line, the run script task (check_point.mgmt.cp_mgmt_run_script) operation times out after 300 seconds and Ansible reports the task as failed.&lt;/P&gt;&lt;P&gt;The task continues to run in he background and completes successfully.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;-------------------------------------------------------------------------------------------------------------------------------------&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Playbook contents&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;hosts: all&lt;BR /&gt;connection: httpapi&lt;BR /&gt;tasks:&lt;UL&gt;&lt;LI&gt;name: save configuration&lt;BR /&gt;check_point.mgmt.cp_mgmt_run_script:&lt;BR /&gt;script_name: "save configuration"&lt;BR /&gt;script: /usr/tmp/scripts/backup/gateway-save-configuration.sh&lt;BR /&gt;targets:&lt;BR /&gt;- "target-01"&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;SPAN&gt;-------------------------------------------------------------------------------------------------------------------------------------&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Task output when run at command line with -vvv verbosity&lt;/P&gt;&lt;P&gt;TASK [save configuration] **************************************************************************************************************************************************************************************************************&lt;BR /&gt;task path: /var/lib/awx/projects/checkpoint/gaia_save_configuration.yml:5&lt;BR /&gt;&amp;lt;10.1.2.51&amp;gt; ESTABLISH LOCAL CONNECTION FOR USER: root&lt;BR /&gt;&amp;lt;10.1.2.51&amp;gt; EXEC /bin/sh -c '( umask 77 &amp;amp;&amp;amp; mkdir -p "echo /root/.ansible/tmp/ansible-local-125848VSLTgw"&amp;amp;&amp;amp; mkdir "echo /root/.ansible/tmp/ansible-local-125848VSLTgw/ansible-tmp-1622157921.29-125969-16013906004820" &amp;amp;&amp;amp; echo ansible-tmp-1622157921.29-125969-16013906004820="echo /root/.ansible/tmp/ansible-local-125848VSLTgw/ansible-tmp-1622157921.29-125969-16013906004820" ) &amp;amp;&amp;amp; sleep 0'&lt;BR /&gt;Using module file /root/.ansible/collections/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_run_script.py&lt;BR /&gt;&amp;lt;10.1.2.51&amp;gt; PUT /root/.ansible/tmp/ansible-local-125848VSLTgw/tmpjqE3Hq TO /root/.ansible/tmp/ansible-local-125848VSLTgw/ansible-tmp-1622157921.29-125969-16013906004820/AnsiballZ_cp_mgmt_run_script.py&lt;BR /&gt;&amp;lt;10.1.2.51&amp;gt; EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-local-125848VSLTgw/ansible-tmp-1622157921.29-125969-16013906004820/ /root/.ansible/tmp/ansible-local-125848VSLTgw/ansible-tmp-1622157921.29-125969-16013906004820/AnsiballZ_cp_mgmt_run_script.py &amp;amp;&amp;amp; sleep 0'&lt;BR /&gt;&amp;lt;10.1.2.51&amp;gt; EXEC /bin/sh -c '/usr/bin/python /root/.ansible/tmp/ansible-local-125848VSLTgw/ansible-tmp-1622157921.29-125969-16013906004820/AnsiballZ_cp_mgmt_run_script.py &amp;amp;&amp;amp; sleep 0'&lt;BR /&gt;&amp;lt;10.1.2.51&amp;gt; EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-local-125848VSLTgw/ansible-tmp-1622157921.29-125969-16013906004820/ &amp;gt; /dev/null 2&amp;gt;&amp;amp;1 &amp;amp;&amp;amp; sleep 0'&lt;BR /&gt;fatal: [10.1.2.51]: FAILED! =&amp;gt; {&lt;BR /&gt;"changed": false,&lt;BR /&gt;"invocation": {&lt;BR /&gt;"module_args": {&lt;BR /&gt;"args": null,&lt;BR /&gt;"comments": null,&lt;BR /&gt;"script": "/usr/tmp/scripts/backup/gateway-save-configuration.sh",&lt;BR /&gt;"script_name": "save configuration",&lt;BR /&gt;"targets": [&lt;BR /&gt;"target-01"&lt;BR /&gt;],&lt;BR /&gt;"version": null,&lt;BR /&gt;"wait_for_task": true,&lt;BR /&gt;"wait_for_task_timeout": 30&lt;BR /&gt;}&lt;BR /&gt;},&lt;BR /&gt;"msg": "Task target-01- save configuration with task id 14cca0a8-81d4-4488-b44c-3340e38c6fd2 failed. Look at the logs for more details"&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;PLAY RECAP *****************************************************************************************************************************************************************************************************************************&lt;BR /&gt;10.1.2.51 : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0&lt;/P&gt;</description>
      <pubDate>Fri, 28 May 2021 03:40:42 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Ansible/cp-mgmt-run-script-module-5-minute-runtime-timeout/m-p/119643#M547</guid>
      <dc:creator>Simon_Macpherso</dc:creator>
      <dc:date>2021-05-28T03:40:42Z</dc:date>
    </item>
    <item>
      <title>Re: cp_mgmt_run_script module 5 minute runtime timeout</title>
      <link>https://community.checkpoint.com/t5/Ansible/cp-mgmt-run-script-module-5-minute-runtime-timeout/m-p/119663#M548</link>
      <description>&lt;P&gt;Your potential answer is in the behavior you describe: explicitly run the task in the background (e.g. with nohup or similar).&lt;BR /&gt;You won’t be able to monitor the results of the script via Ansible or the API, but the call won’t fail either.&lt;/P&gt;</description>
      <pubDate>Fri, 28 May 2021 07:39:26 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Ansible/cp-mgmt-run-script-module-5-minute-runtime-timeout/m-p/119663#M548</guid>
      <dc:creator>PhoneBoy</dc:creator>
      <dc:date>2021-05-28T07:39:26Z</dc:date>
    </item>
    <item>
      <title>Re: cp_mgmt_run_script module 5 minute runtime timeout</title>
      <link>https://community.checkpoint.com/t5/Ansible/cp-mgmt-run-script-module-5-minute-runtime-timeout/m-p/119773#M549</link>
      <description>&lt;P&gt;How can a task be run in the background?&lt;/P&gt;&lt;P&gt;If i cant monitor the task directly it wont matter in this instance. My script outputs a log file which I can monitor.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Using the async parameter with poll = 0 doesn't work. The job doesn't start even though stdout reports the job as started.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Using the ignore_errors parameter doesn't work as the job still shows as failed in the smart console recent task list, which I want to avoid.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Again I've had to split the playbook out in to multiple tasks.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 31 May 2021 01:54:57 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Ansible/cp-mgmt-run-script-module-5-minute-runtime-timeout/m-p/119773#M549</guid>
      <dc:creator>Simon_Macpherso</dc:creator>
      <dc:date>2021-05-31T01:54:57Z</dc:date>
    </item>
    <item>
      <title>Re: cp_mgmt_run_script module 5 minute runtime timeout</title>
      <link>https://community.checkpoint.com/t5/Ansible/cp-mgmt-run-script-module-5-minute-runtime-timeout/m-p/119845#M550</link>
      <description>&lt;P&gt;As I suggested: using nohup.&lt;BR /&gt;More precisely, invoke whatever script has your commands with nohup (e.g. /usr/bin/nohup /home/admin/whateverscript.sh)&lt;BR /&gt;This will run the script in the background and pipe output to nohup.out.&lt;/P&gt;</description>
      <pubDate>Mon, 31 May 2021 02:36:22 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Ansible/cp-mgmt-run-script-module-5-minute-runtime-timeout/m-p/119845#M550</guid>
      <dc:creator>PhoneBoy</dc:creator>
      <dc:date>2021-05-31T02:36:22Z</dc:date>
    </item>
    <item>
      <title>Re: cp_mgmt_run_script module 5 minute runtime timeout</title>
      <link>https://community.checkpoint.com/t5/Ansible/cp-mgmt-run-script-module-5-minute-runtime-timeout/m-p/119988#M551</link>
      <description>&lt;P&gt;using nohup doesn't work&lt;/P&gt;&lt;P&gt;ive used nohup &amp;lt;command&amp;gt; &amp;amp; to launch the bash script in the background&amp;nbsp;&lt;/P&gt;&lt;P&gt;the inherent limitation in the run script API endpoint persists.&lt;/P&gt;</description>
      <pubDate>Tue, 01 Jun 2021 02:31:03 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Ansible/cp-mgmt-run-script-module-5-minute-runtime-timeout/m-p/119988#M551</guid>
      <dc:creator>Simon_Macpherso</dc:creator>
      <dc:date>2021-06-01T02:31:03Z</dc:date>
    </item>
  </channel>
</rss>

