List of access policy configurations.
The network ID.
The state of the resource.
A template task showing all available parameters with their defaults or example values.
- name: Meraki Switch Access Policies task cisco.meraki_rm.meraki_switch_access_policies: network_id: "192.168.1.0/24" config: - access_policy_number: "access_policy_number_value" access_policy_type: "access_policy_type_value" dot1x: {} guest_vlan_id: 0 host_mode: "hostname.example.com" name: "example_name" radius_accounting_enabled: true radius_accounting_servers: - {} radius_coa_support_enabled: true radius_servers: - {} state: merged
- name: Meraki Switch Access Policies task cisco.meraki_rm.meraki_switch_access_policies: network_id: "192.168.1.0/24" config: # optional - access_policy_number: "access_policy_number_value" # optional access_policy_type: "access_policy_type_value" # optional dot1x: {} # optional guest_vlan_id: 0 # optional host_mode: "hostname.example.com" # optional name: "example_name" # optional radius_accounting_enabled: true # optional radius_accounting_servers: # optional - {} radius_coa_support_enabled: true # optional radius_servers: # optional - {} state: merged # optional
- name: Meraki Switch Access Policies task cisco.meraki_rm.meraki_switch_access_policies: network_id: "192.168.1.0/24" # (str, required) The network ID. config: # (list, optional) List of access policy configurations. - access_policy_number: "access_policy_number_value" # (str, optional) Access policy number (identifier). access_policy_type: "access_policy_type_value" # (str, optional) Access type of the policy. dot1x: {} # (dict, optional) 802.1X settings. guest_vlan_id: 0 # (int, optional) Guest VLAN ID for unauthorized devices. host_mode: "hostname.example.com" # (str, optional) Host mode for the access policy. name: "example_name" # (str, optional) Name of the access policy. radius_accounting_enabled: true # (bool, optional) Enable RADIUS accounting. radius_accounting_servers: # (list, optional) List of RADIUS accounting servers. - {} radius_coa_support_enabled: true # (bool, optional) Enable RADIUS CoA support. radius_servers: # (list, optional) List of RADIUS servers for authentication. - {} state: merged # (str, optional) The state of the resource.
access_policy_number — user-assigned, used for both identification and API routing.- name: Define expected configuration ansible.builtin.set_fact: expected_config: access_policy_number: example name: Test-Config access_policy_type: example host_mode: example radius_accounting_enabled: true radius_coa_support_enabled: true guest_vlan_id: 1
- name: Create switch_access_policies with merged state cisco.meraki_rm.meraki_switch_access_policies: network_id: "N_123456789012345678" 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: access_policy_number: example name: Replaced-Config access_policy_type: example host_mode: example radius_accounting_enabled: true radius_coa_support_enabled: true guest_vlan_id: 1
- name: Replace switch_access_policies configuration cisco.meraki_rm.meraki_switch_access_policies: network_id: "N_123456789012345678" 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: access_policy_number: example name: Replaced-Config access_policy_type: example host_mode: example radius_accounting_enabled: true radius_coa_support_enabled: true guest_vlan_id: 1
- name: Override all switch_access_policies — desired state only cisco.meraki_rm.meraki_switch_access_policies: network_id: "N_123456789012345678" 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 switch_access_policies configuration cisco.meraki_rm.meraki_switch_access_policies: network_id: "N_123456789012345678" 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: access_policy_number: example
- name: Delete switch_access_policies configuration cisco.meraki_rm.meraki_switch_access_policies: network_id: "N_123456789012345678" 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 switch access policies — create or update - name: Define expected configuration ansible.builtin.set_fact: expected_config: access_policy_number: example name: Test-Config access_policy_type: example host_mode: example radius_accounting_enabled: true radius_coa_support_enabled: true guest_vlan_id: 1 - name: Create switch_access_policies with merged state cisco.meraki_rm.meraki_switch_access_policies: network_id: "N_123456789012345678" 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 switch access policies — full resource replacement - name: Define replacement configuration ansible.builtin.set_fact: expected_config: access_policy_number: example name: Replaced-Config access_policy_type: example host_mode: example radius_accounting_enabled: true radius_coa_support_enabled: true guest_vlan_id: 1 - name: Replace switch_access_policies configuration cisco.meraki_rm.meraki_switch_access_policies: network_id: "N_123456789012345678" 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 switch access policies — override all instances # Ensures ONLY these resources exist; any not listed are deleted. - name: Define desired-state configuration ansible.builtin.set_fact: expected_config: access_policy_number: example name: Replaced-Config access_policy_type: example host_mode: example radius_accounting_enabled: true radius_coa_support_enabled: true guest_vlan_id: 1 - name: Override all switch_access_policies — desired state only cisco.meraki_rm.meraki_switch_access_policies: network_id: "N_123456789012345678" 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 switch access policies — gather current configuration - name: Gather current switch_access_policies configuration cisco.meraki_rm.meraki_switch_access_policies: network_id: "N_123456789012345678" 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 switch access policies — remove configuration - name: Define resource to delete ansible.builtin.set_fact: expected_config: access_policy_number: example - name: Delete switch_access_policies configuration cisco.meraki_rm.meraki_switch_access_policies: network_id: "N_123456789012345678" 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