Hi,
I find that nsible gives me a bit of a headache. I can add objects without a problem by using "state: present" but if I set all objects to "state: absent" I run into dependency issue.
My current playbook I am testing with is:
---
- name: Create Objects
hosts: cpmgmt
connection: httpapi
tasks:
- name: Subnet NET-TEST-1
check_point.mgmt.cp_mgmt_network:
name: "NET-TEST-1"
subnet: "192.168.1.0"
mask_length: 24
color: red
state: present
- name: Subnet NET-TEST-2
check_point.mgmt.cp_mgmt_network:
name: "NET-TEST-2"
subnet: "192.168.2.0"
mask_length: 24
color: purple
state: present
- name: Subnet NET-TEST-3
check_point.mgmt.cp_mgmt_network:
name: "NET-TEST-3"
subnet: "192.168.3.0"
mask_length: 24
color: blue
state: present
- name: Group GRP-NET-TEST
cp_mgmt_group:
name: GRP-NET-TEST
members:
- NET-TEST-1
- NET-TEST-2
- NET-TEST-3
color: dark gold
state: present
- name: Publish
check_point.mgmt.cp_mgmt_publish:
So somehow you also need to change the order of the tasks if you want to delete objects. And that would defeat the purpose of ansible in my view.
So how do other handle playbooks like this?
<< We make miracles happen while you wait. The impossible jobs take just a wee bit longer. >>