Create a Post
cancel
Showing results for 
Search instead for 
Did you mean: 
Govind135438
Participant
Jump to solution

Handling locked by another session issue in Ansible playbooks

I am facing the error like below from Ansible playbook from modules from "check_point.mgmt" collection. 

TASK [Add VLAN interface to Management gateway object] **************************************************************************************************************
fatal: [10.25.58.51]: FAILED! => {"changed": false, "msg": "Checkpoint device returned error 400 with message {'code': 'generic_error', 'message': \"Action cannot be executed on object: gw-893628 due to: Object 'gw-893628' is locked by another session.\"} Unpublished changes were discarded"}

This error occurs when I have some unpublished changes from Check Point Smartconsole or command-line. 

How can I force changes from Ansible when there are unpublished changes from others? Or what is the best practice to follow in this scenario?

0 Kudos
1 Solution

Accepted Solutions
Duane_Toler
MVP Silver
MVP Silver

You can't publish another session, reliably, even if your administrator account has access to do so.  You don't want to do this.  Instead, you need to open SmartConsole -> Manage & Settings -> Sessions and see who has open sessions and object locks.  You either need to discard those sessions (if you have permissions to do so), or ask the other administrators to close their sessions.  The management server is trying to protect you from unwanted, and unexpected, results that you may not want.  Don't violate this or you will have trouble.

--
Ansible for Check Point APIs series: https://www.youtube.com/@EdgeCaseScenario and Substack

View solution in original post

3 Replies
Daniel_Kuhl1
Employee Employee
Employee

A quick answer from my mind without any validation from documentation:

  1. Run show-sessions API call to get all sessions
  2. Then looping through the sessions and find sessions with locks using show-session API call
    • take-over the session
    • discard or publish to get rid of the locks 
  3. continue with your changes

...but I think the Ansible collection does not support all of it, so you have to build your own API calls using Web-Services API.

Maybe CheckMates folks find a better way.

0 Kudos
Govind135438
Participant

Thank you for your response. I will try your solution. 

Duane_Toler
MVP Silver
MVP Silver

You can't publish another session, reliably, even if your administrator account has access to do so.  You don't want to do this.  Instead, you need to open SmartConsole -> Manage & Settings -> Sessions and see who has open sessions and object locks.  You either need to discard those sessions (if you have permissions to do so), or ask the other administrators to close their sessions.  The management server is trying to protect you from unwanted, and unexpected, results that you may not want.  Don't violate this or you will have trouble.

--
Ansible for Check Point APIs series: https://www.youtube.com/@EdgeCaseScenario and Substack

Leaderboard

Epsum factorial non deposit quid pro quo hic escorol.

Upcoming Events

    CheckMates Events