First of all, since this is an automation/scripting question, let me move this to Developers (Code Hub).
Second, up until fairly recently, most of our APIs were related to security policy management, not necessarily gateway/OS configuration.
That said, we just released new REST APIs for this: https://community.checkpoint.com/community/infinity-general/appliances-and-gaia/blog/2019/01/21/new-...
That said, I know we have been working on something with Ansible that leverages this API.
It's not yet publicly available.