List of policy object configurations.
The organization ID.
The state of the resource.
A template task showing all available parameters with their defaults or example values.
- name: Meraki Organization Policy Objects task cisco.meraki_rm.meraki_organization_policy_objects: organization_id: "organization_id_value" config: - category: adaptivePolicy cidr: "cidr_value" fqdn: "fqdn_value" group_ids: - "group_ids_item" ip: "192.168.1.1" mask: "mask_value" name: "example_name" policy_object_id: "policy_object_id_value" type: adaptivePolicyIpv4Cidr state: merged
- name: Meraki Organization Policy Objects task cisco.meraki_rm.meraki_organization_policy_objects: organization_id: "organization_id_value" config: # optional - category: adaptivePolicy # optional cidr: "cidr_value" # optional fqdn: "fqdn_value" # optional group_ids: # optional - "group_ids_item" ip: "192.168.1.1" # optional mask: "mask_value" # optional name: "example_name" # optional policy_object_id: "policy_object_id_value" # optional type: adaptivePolicyIpv4Cidr # optional state: merged # optional
- name: Meraki Organization Policy Objects task cisco.meraki_rm.meraki_organization_policy_objects: organization_id: "organization_id_value" # (str, required) The organization ID. config: # (list, optional) List of policy object configurations. - category: adaptivePolicy # (str, optional) Category of policy object. cidr: "cidr_value" # (str, optional) CIDR value (for cidr type). fqdn: "fqdn_value" # (str, optional) Fully qualified domain name (for fqdn type). group_ids: # (list, optional) IDs of policy object groups this object belongs to. - "group_ids_item" ip: "192.168.1.1" # (str, optional) IP address (for ipAndMask type). mask: "mask_value" # (str, optional) Subnet mask (for ipAndMask type). name: "example_name" # (str, optional) Name of the policy object. policy_object_id: "policy_object_id_value" # (str, optional) Server-assigned ID, resolved automatically by matching on... type: adaptivePolicyIpv4Cidr # (str, optional) Type of policy object. state: merged # (str, optional) The state of the resource.
name — identifies the resource in playbooks.policy_object_id — server-assigned, resolved automatically from gathered state.policy_object_id unless disambiguating duplicate names.- name: Define expected configuration ansible.builtin.set_fact: expected_config: name: Test-Config category: adaptivePolicy type: adaptivePolicyIpv4Cidr cidr: 192.168.128.0/24 fqdn: example.com ip: 10.0.0.1 mask: 24
- name: Create organization_policy_objects with merged state cisco.meraki_rm.meraki_organization_policy_objects: organization_id: "123456" state: merged config: - "{{ expected_config }}" register: merge_result
- name: Assert resource was created ansible.builtin.assert: that: - merge_result is changed - merge_result.config | length == 1
- name: Compare expected paths to result (subset check) ansible.builtin.set_fact: path_check: "{{ expected_paths | cisco.meraki_rm.path_contained_in(result_paths) }}" vars: expected_paths: "{{ expected_config | ansible.utils.to_paths }}" result_paths: "{{ merge_result.config[0] | ansible.utils.to_paths }}"
- name: Assert all expected fields are present and match ansible.builtin.assert: that: path_check.contained | bool success_msg: "{{ success_msg }}" fail_msg: "{{ fail_msg }}" vars: success_msg: "All expected fields match. Extras: {{ path_check.extras }}" fail_msg: "Missing or mismatch: {{ path_check.missing }}. Extras: {{ path_check.extras }}"
- name: Define replacement configuration ansible.builtin.set_fact: expected_config: name: Test-Config category: network type: cidr cidr: 192.168.128.0/24 fqdn: example.com ip: 10.0.0.1 mask: 24
- name: Replace organization_policy_objects configuration cisco.meraki_rm.meraki_organization_policy_objects: organization_id: "123456" state: replaced config: - "{{ expected_config }}" register: replace_result
- name: Assert resource was replaced ansible.builtin.assert: that: - replace_result is changed - replace_result.config | length == 1
- name: Compare expected paths to result (subset check) ansible.builtin.set_fact: path_check: "{{ expected_paths | cisco.meraki_rm.path_contained_in(result_paths) }}" vars: expected_paths: "{{ expected_config | ansible.utils.to_paths }}" result_paths: "{{ replace_result.config[0] | ansible.utils.to_paths }}"
- name: Assert all expected fields are present and match ansible.builtin.assert: that: path_check.contained | bool success_msg: "{{ success_msg }}" fail_msg: "{{ fail_msg }}" vars: success_msg: "All expected fields match. Extras: {{ path_check.extras }}" fail_msg: "Missing or mismatch: {{ path_check.missing }}. Extras: {{ path_check.extras }}"
- name: Define desired-state configuration ansible.builtin.set_fact: expected_config: name: Test-Config category: network type: cidr cidr: 192.168.128.0/24 fqdn: example.com ip: 10.0.0.1 mask: 24
- name: Override all organization_policy_objects — desired state only cisco.meraki_rm.meraki_organization_policy_objects: organization_id: "123456" state: overridden config: - "{{ expected_config }}" register: override_result
- name: Assert resources were overridden ansible.builtin.assert: that: - override_result is changed - override_result.config | length == 1
- name: Compare expected paths to result (subset check) ansible.builtin.set_fact: path_check: "{{ expected_paths | cisco.meraki_rm.path_contained_in(result_paths) }}" vars: expected_paths: "{{ expected_config | ansible.utils.to_paths }}" result_paths: "{{ override_result.config[0] | ansible.utils.to_paths }}"
- name: Assert all expected fields are present and match ansible.builtin.assert: that: path_check.contained | bool success_msg: "{{ success_msg }}" fail_msg: "{{ fail_msg }}" vars: success_msg: "All expected fields match. Extras: {{ path_check.extras }}" fail_msg: "Missing or mismatch: {{ path_check.missing }}. Extras: {{ path_check.extras }}"
- name: Gather current organization_policy_objects configuration cisco.meraki_rm.meraki_organization_policy_objects: organization_id: "123456" state: gathered register: gathered
- name: Assert gathered config is not empty ansible.builtin.assert: that: - gathered.config is defined - gathered.config | length > 0 fail_msg: "Gathered config is empty — expected at least one resource"
- name: Display gathered configuration ansible.builtin.debug: var: gathered.config
- name: Define resource to delete ansible.builtin.set_fact: expected_config: name: Test-Config
- name: Delete organization_policy_objects configuration cisco.meraki_rm.meraki_organization_policy_objects: organization_id: "123456" state: deleted config: - "{{ expected_config }}" register: delete_result
- name: Assert resource was deleted ansible.builtin.assert: that: - delete_result is changed - delete_result is not failed
--- # Manage Meraki organization policy objects — create or update - name: Define expected configuration ansible.builtin.set_fact: expected_config: name: Test-Config category: adaptivePolicy type: adaptivePolicyIpv4Cidr cidr: 192.168.128.0/24 fqdn: example.com ip: 10.0.0.1 mask: 24 - name: Create organization_policy_objects with merged state cisco.meraki_rm.meraki_organization_policy_objects: organization_id: "123456" state: merged config: - "{{ expected_config }}" register: merge_result - name: Assert resource was created ansible.builtin.assert: that: - merge_result is changed - merge_result.config | length == 1 - name: Compare expected paths to result (subset check) ansible.builtin.set_fact: path_check: "{{ expected_paths | cisco.meraki_rm.path_contained_in(result_paths) }}" vars: expected_paths: "{{ expected_config | ansible.utils.to_paths }}" result_paths: "{{ merge_result.config[0] | ansible.utils.to_paths }}" - name: Assert all expected fields are present and match ansible.builtin.assert: that: path_check.contained | bool success_msg: "{{ success_msg }}" fail_msg: "{{ fail_msg }}" vars: success_msg: "All expected fields match. Extras: {{ path_check.extras }}" fail_msg: "Missing or mismatch: {{ path_check.missing }}. Extras: {{ path_check.extras }}" # Manage Meraki organization policy objects — full resource replacement - name: Define replacement configuration ansible.builtin.set_fact: expected_config: name: Test-Config category: network type: cidr cidr: 192.168.128.0/24 fqdn: example.com ip: 10.0.0.1 mask: 24 - name: Replace organization_policy_objects configuration cisco.meraki_rm.meraki_organization_policy_objects: organization_id: "123456" state: replaced config: - "{{ expected_config }}" register: replace_result - name: Assert resource was replaced ansible.builtin.assert: that: - replace_result is changed - replace_result.config | length == 1 - name: Compare expected paths to result (subset check) ansible.builtin.set_fact: path_check: "{{ expected_paths | cisco.meraki_rm.path_contained_in(result_paths) }}" vars: expected_paths: "{{ expected_config | ansible.utils.to_paths }}" result_paths: "{{ replace_result.config[0] | ansible.utils.to_paths }}" - name: Assert all expected fields are present and match ansible.builtin.assert: that: path_check.contained | bool success_msg: "{{ success_msg }}" fail_msg: "{{ fail_msg }}" vars: success_msg: "All expected fields match. Extras: {{ path_check.extras }}" fail_msg: "Missing or mismatch: {{ path_check.missing }}. Extras: {{ path_check.extras }}" # Manage Meraki organization policy objects — override all instances # Ensures ONLY these resources exist; any not listed are deleted. - name: Define desired-state configuration ansible.builtin.set_fact: expected_config: name: Test-Config category: network type: cidr cidr: 192.168.128.0/24 fqdn: example.com ip: 10.0.0.1 mask: 24 - name: Override all organization_policy_objects — desired state only cisco.meraki_rm.meraki_organization_policy_objects: organization_id: "123456" state: overridden config: - "{{ expected_config }}" register: override_result - name: Assert resources were overridden ansible.builtin.assert: that: - override_result is changed - override_result.config | length == 1 - name: Compare expected paths to result (subset check) ansible.builtin.set_fact: path_check: "{{ expected_paths | cisco.meraki_rm.path_contained_in(result_paths) }}" vars: expected_paths: "{{ expected_config | ansible.utils.to_paths }}" result_paths: "{{ override_result.config[0] | ansible.utils.to_paths }}" - name: Assert all expected fields are present and match ansible.builtin.assert: that: path_check.contained | bool success_msg: "{{ success_msg }}" fail_msg: "{{ fail_msg }}" vars: success_msg: "All expected fields match. Extras: {{ path_check.extras }}" fail_msg: "Missing or mismatch: {{ path_check.missing }}. Extras: {{ path_check.extras }}" # Manage Meraki organization policy objects — gather current configuration - name: Gather current organization_policy_objects configuration cisco.meraki_rm.meraki_organization_policy_objects: organization_id: "123456" state: gathered register: gathered - name: Assert gathered config is not empty ansible.builtin.assert: that: - gathered.config is defined - gathered.config | length > 0 fail_msg: "Gathered config is empty — expected at least one resource" - name: Display gathered configuration ansible.builtin.debug: var: gathered.config # Manage Meraki organization policy objects — remove configuration - name: Define resource to delete ansible.builtin.set_fact: expected_config: name: Test-Config - name: Delete organization_policy_objects configuration cisco.meraki_rm.meraki_organization_policy_objects: organization_id: "123456" state: deleted config: - "{{ expected_config }}" register: delete_result - name: Assert resource was deleted ansible.builtin.assert: that: - delete_result is changed - delete_result is not failed