A playbook adds a host object with cp_mgmt_host, reports changed, and cp_mgmt_host_facts even shows the new object. But in SmartConsole the host does not exist. Why, and how do you fix it?
The change was made in the playbook's own API session and never published, so it stayed private to that session; add a cp_mgmt_publish task or set auto_publish_session: true.
The facts output gives it away: the object's meta-info says "lock": "locked by current session". The facts task ran in the same API session as the add, so it can see the session's private change. SmartConsole is a different session and only sees published objects.
Two fixes:
- name: add-host
check_point.mgmt.cp_mgmt_host:
name: "HSLU-Test-Host"
ip_address: 192.168.1.1
state: present
auto_publish_session: true # publish right after this task
- name: publish everything done so far in this session
check_point.mgmt.cp_mgmt_publish:
auto_publish_session is convenient for a single change. One explicit cp_mgmt_publish at the end is usually better for a batch: everything appears as one published change (one entry in the audit log, all or nothing).
Until it is published or discarded, the abandoned change also leaves the object locked for other administrators. An administrator can take over that session in SmartConsole and publish or discard it.
Go deeper:
cp_mgmt_publish module (Ansible docs) — the publish task.
Session Flow for Administrators (Check Point R82 admin guide) — private changes, locks and taking over a session.