Create a Post
cancel
Showing results for 
Search instead for 
Did you mean: 
Simon_Macpherso
Advisor

Ansible Playbook Error

Hello All,

 

I have a playbook that is using the cp_mgmt_run_script module. The following error is returned when the playbook is run. 


TASK [run-script] ****************************************************************************************************************
fatal: [10.1.2.51]: FAILED! => {"ansible_facts": {"discovered_interpreter_python": "/usr/bin/python"}, "changed": false, "msg": {" code": "generic_err_invalid_parameter", "message": "ERROR: Failed to handle asynchronous tasks as synchronous, tasks result is und efined.\nInvalid parameter for [task-id]. Invalid value"}}

The task actually runs successfully against the target gateway, the task appears in the SmartConsole task list and returns the expected result. 

 

Excerpt from $FWDIR/log/api.elg

---------------------------
ID: 14684
Response-Code: 400
Content-Type: application/json
Headers: {Content-Type=[application/json], Date=[Thu, 23 Jul 2020 23:57:15 GMT]}
Payload: {
"code" : "generic_err_invalid_parameter",
"message" : "Invalid parameter for [task-id]. Invalid value"
}
--------------------------------------
2020-07-23 23:57:17,419 INFO org.apache.cxf.interceptor.LoggingInInterceptor.log:250 [qtp1325351680-37] - Inbound Message
----------------------------
ID: 14685
Address: http://127.0.0.1:50276/web_api/show-task
Encoding: ISO-8859-1
Http-Method: POST
Content-Type: application/json
Headers: {accept-encoding=[identity], connection=[keep-alive], Content-Length=[114], content-type=[application/json], Host=[127.0.0.1:50276], User-Agent=[Python-urllib/2.7], X-Chkp-Sid=[8b04d47571c316b5c41d763d30263ffe], X-Forwarded-For=[10.1.7.110], X-Forwarded-Host=[10.1.2.51:443], X-Forwarded-Host-Port=[443], X-Forwarded-Server=[10.1.2.51]}
Payload: {"task-id": {"task-id": "01466935-7a42-4478-89bd-d38019364e0b", "target": "26db824a-f9a9-436b-a826-9899f41c8c4e"}}
--------------------------------------
2020-07-23 23:57:17,425 WARN com.checkpoint.management.web_api_is.utils.helpers.RequestHeadersHelper.getMediaType_aroundBody6:9 [qtp1325351680-37] - No Accept header received. Falling back to default media type [application/json].
2020-07-23 23:57:17,426 INFO com.checkpoint.management.web_api_is.utils.helpers.ApiCache.<init>:21 [qtp1325351680-37] - Cache created and initialized
2020-07-23 23:57:17,427 ERROR com.checkpoint.management.web_api_is.utils.jackson.deserializers.BaseMultiValueDeserializer.deserializeSingleObject_aroundBody2:16 [qtp1325351680-37] - Failed to deserialize parameter: [task-id], value is not from type: [java.lang.String]
2020-07-23 23:57:17,427 ERROR com.checkpoint.management.web_api_is.exceptions.WebApiGeneralException.log:42 [qtp1325351680-37] - Error code: [GENERIC_ERR_INVALID_PARAMETER]
2020-07-23 23:57:17,428 ERROR com.checkpoint.management.web_api_is.exceptions.WebApiGeneralException.log:43 [qtp1325351680-37] - Error message: [Invalid parameter for [task-id]. Invalid value]

Here is my playbook

---
- hosts: checkpoint
connection: httpapi
gather_facts: False
tasks:
- name: run-script
cp_mgmt_run_script:
script_name: "List root"
script: ls -l /
targets:
- "26db824a-f9a9-436b-a826-9899f41c8c4e"
register: show_list_root_response
- name: display list root results
debug:
msg: "{{ show_list_root_response }}"

 

Regards,

Simon

0 Kudos
2 Replies
Jacco_Gillis
Explorer

I had the same issue.

I was able to workaround the issue by adding 'wait_for_task: "no"' to the task parameters.

0 Kudos
Jim_Oqvist
Employee
Employee

Hi Simon,

There is an issue with the cp_mgmt_run_script included by default in ansible 2.9+.
This is fixed in the collection in galaxy and I believe also in the collection included in ansible 2.10

Remember to always use the latest updated collection available here:
https://galaxy.ansible.com/check_point/mgmt

You can find information about the updates in the different releases of the collection here:
https://github.com/CheckPointSW/CheckPointAnsibleMgmtCollection/releases

Kind Regards
Jim

0 Kudos

Leaderboard

Epsum factorial non deposit quid pro quo hic escorol.

Upcoming Events

    CheckMates Events