- Products
- Learn
- Local User Groups
- Partners
- More
On-Premise SD-WAN Management
Register HereWhat's New in R82.10?
Watch Here AI Security Masters E8:
Claude Mythos: New Era in Cyber Security
CheckMates Go:
The Moment Before
I'm trying to write a simple ansible play, containing only a login and a logout task, by following the instructions found here: https://github.com/CheckPointSW/cpAnsible .
My playbook looks like this:
---
- hosts: "firewalls"
tasks:
- name: "login"
check_point_mgmt:
command: login
parameters:
username: "{{mgmt_user}}"
password: "{{mgmt_password}}"
management: "{{mgmt_server}}"
fingerprint: "{{mgmt_fingerprint}}"
register: login_response
- name: "logout"
check_point_mgmt:
command: logout
session-data: "{{login_response}}"
The login goes ok, but the logout task fails with the following error:
fatal: [127.0.0.1]: FAILED! => {"changed": false, "msg": "Command 'logout None' failed with error message: Missing header: [X-chkp-sid]. All changes are discarded and the session is invalidated."}
It appears I am unable to obtain a session-id, but I have no idea of how to resolve this.
have you configured your management API server to accept connections from remote machines?
Do you have any indication that login command was successful?
session-data holds the session-id inside.
robert.
To be honest, I'm not sure. When running the playbook with the --verbose flag the login task shows ok but sid shows "null".
Here is my full output:
PLAY [firewalls] ********************************************************************
TASK [Gathering Facts] **************************************************************
ok: [127.0.0.1]
TASK [login] ************************************************************************
ok: [127.0.0.1] => {"changed": false, "response": {"domain": null, "fingerprint": "002451E2D9743CDACC8F7178761FAE4C017AB039", "sid": null, "url": "10.99.81.101:443"}}
TASK [logout] ***********************************************************************
fatal: [127.0.0.1]: FAILED! => {"changed": false, "msg": "Command 'logout None' failed with error message: Missing header: [X-chkp-sid]. All changes are discarded and the session is invalidated."}
to retry, use: --limit @/home/simand/ansible_platform/cp_test.retry
PLAY RECAP **************************************************************************
127.0.0.1 : ok=2 changed=0 unreachable=0 failed=1
have you configured your management API server to accept connections from remote machines?
I feel so stupid now. I had completely missed that step in the tutorial. Thank you.
Hello Dameon Welch-Abernathy and other folks,
I need your help to fix 1 issue .
While executing your given script in my test environment i am getting below error:
TASK [Add CheckMatesDemo group] ****************************************************************************************************************************************
fatal: [localhost]: FAILED! => {"changed": false, "msg": "Command 'add-group {u'name': u'CheckMatesDemo'}'
failed with error message: Missing header: [X-chkp-sid]. All changes are discarded and the session is invalidated."}
to retry, use: --limit @/etc/ansible/cp2.retry
I am trying to execute CheckMates_AddHost.yml
FYI: API is enable on the MGMT server for all IP addresses but don't know why SID is coming as null.
Which "given script" are you discussing?
I recommend posting the question on the relevant thread where the script was shared with more details about how exactly you are invoking it.
In general, you have to "login" to the API, which will generate a session ID.
That session ID would be passed via a X-chkp-sid on subsequent calls to the API.
My guess is in the ansible playbook you called, you forgot the login action.
But, like I said, I recommend continuing the discussion on the relevant thread.
Thanks for the reply Dameon Welch-Abernathy
There was some permission issue. post correction that everything worked as expected.
Hello, I'm getting the same error message and I've tried many things but doesn't work. Do you mind elaborating what you did to resolve your issues? Thanks.
Tue 14 Jul 2026 @ 10:00 AM (PDT)
AI Security Masters E11: READY OR NOT: Securing the AI Enterprise 3/5 - AI Workforce SecurityThu 30 Jul 2026 @ 10:00 AM (PDT)
AI Security Masters E12: READY OR NOT: Securing the AI Enterprise 4/5 - AI GatewayThu 20 Aug 2026 @ 10:00 AM (PDT)
AI Security Masters E13: READY OR NOT: Securing the AI Ent 5/5 - AI Research & Threat LandscapeTue 14 Jul 2026 @ 10:00 AM (PDT)
AI Security Masters E11: READY OR NOT: Securing the AI Enterprise 3/5 - AI Workforce SecurityThu 30 Jul 2026 @ 10:00 AM (PDT)
AI Security Masters E12: READY OR NOT: Securing the AI Enterprise 4/5 - AI GatewayThu 20 Aug 2026 @ 10:00 AM (PDT)
AI Security Masters E13: READY OR NOT: Securing the AI Ent 5/5 - AI Research & Threat LandscapeAbout CheckMates
Learn Check Point
Advanced Learning
YOU DESERVE THE BEST SECURITY