LOGBOOK

HELP

Quiz Entry - updated: 2026.11.26

You run the add-host playbook twice with the same values. What does the second run report, and how does the module know? How do you delete the object again?

The second run reports ok (not changed): the module first asks the server whether an identical object already exists and skips the add. Deleting is the same task with state: absent.

cp_mgmt_host is idempotent. Before changing anything it sends the API an equals request with the parameters you gave:

  • object does not exist → add-host, result changed;
  • it exists but differs (say another colour) → set-host, result changed;
  • it exists and matches → nothing, result ok.

So the playbook describes the desired state, and you can run it as often as you like. That is what makes it safe to schedule or to put in a pipeline.

To remove the object:

    - name: delete-host
      check_point.mgmt.cp_mgmt_host:
        name: "HSLU-Test-Host"
        state: absent
        auto_publish_session: true

state: absent deletes it if it exists and does nothing if it does not. Like every change, the deletion only becomes real for others once it is published.

Go deeper:

From Quiz: ITIA / Network Automation with Ansible and a Check Point Firewall | Updated: Nov 26, 2026