List of switch stack 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 Stacks task cisco.meraki_rm.meraki_switch_stacks: network_id: "192.168.1.0/24" config: - is_monitor_only: true members: - {} name: "example_name" serials: - "serials_item" switch_stack_id: "switch_stack_id_value" virtual_mac: "virtual_mac_value" state: merged
- name: Meraki Switch Stacks task cisco.meraki_rm.meraki_switch_stacks: network_id: "192.168.1.0/24" config: # optional - is_monitor_only: true # optional members: # optional - {} name: "example_name" # optional serials: # optional - "serials_item" switch_stack_id: "switch_stack_id_value" # optional virtual_mac: "virtual_mac_value" # optional state: merged # optional
- name: Meraki Switch Stacks task cisco.meraki_rm.meraki_switch_stacks: network_id: "192.168.1.0/24" # (str, required) The network ID. config: # (list, optional) List of switch stack configurations. - is_monitor_only: true # (bool, optional) Whether stack is monitor only. members: # (list, optional) Members of the stack. - {} name: "example_name" # (str, optional) Name of the switch stack. serials: # (list, optional) Serials of switches in the stack. - "serials_item" switch_stack_id: "switch_stack_id_value" # (str, optional) Server-assigned ID, resolved automatically by matching on... virtual_mac: "virtual_mac_value" # (str, optional) Virtual MAC address of the switch stack. state: merged # (str, optional) The state of the resource.
name — identifies the resource in playbooks.switch_stack_id — server-assigned, resolved automatically from gathered state.switch_stack_id unless disambiguating duplicate names.- name: Define expected configuration ansible.builtin.set_fact: expected_config: name: Test-Config
- name: Create switch_stacks with merged state cisco.meraki_rm.meraki_switch_stacks: 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: Gather current switch_stacks configuration cisco.meraki_rm.meraki_switch_stacks: 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: name: Test-Config
- name: Delete switch_stacks configuration cisco.meraki_rm.meraki_switch_stacks: 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 stacks — create or update - name: Define expected configuration ansible.builtin.set_fact: expected_config: name: Test-Config - name: Create switch_stacks with merged state cisco.meraki_rm.meraki_switch_stacks: 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 stacks — gather current configuration - name: Gather current switch_stacks configuration cisco.meraki_rm.meraki_switch_stacks: 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 stacks — remove configuration - name: Define resource to delete ansible.builtin.set_fact: expected_config: name: Test-Config - name: Delete switch_stacks configuration cisco.meraki_rm.meraki_switch_stacks: 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