100%

meraki_organization_config_templates

module
Manage Meraki organization configuration templates
Added in version 0.1.0

Synopsis

  • Manage Meraki organization configuration templates.
  • Supports merged, replaced, overridden, deleted, and gathered states.

Author

Cisco Meraki

Parameters

config (list/dict)

List of configuration template configurations.

config_template_id (str)

Server-assigned ID, resolved automatically by matching on name.

Provide only to disambiguate when duplicate names exist.

copy_from_network_id (str)

Network or template ID to copy configuration from.

name (str)

Name of the configuration template.

product_types (list/str)

Product types (e.g. wireless, switch, appliance).

time_zone (str)

Timezone of the configuration template.

organization_id (str) required

The organization ID.

state (str)
mergedreplacedoverriddendeletedgathered

The state of the resource.

Sample Task

A template task showing all available parameters with their defaults or example values.

- name: Meraki Organization Config Templates task
  cisco.meraki_rm.meraki_organization_config_templates:
    organization_id: "organization_id_value"
    config:
      - config_template_id: "config_template_id_value"
        copy_from_network_id: "192.168.1.0/24"
        name: "example_name"
        product_types:
          - "product_types_item"
        time_zone: "time_zone_value"
    state: merged
- name: Meraki Organization Config Templates task
  cisco.meraki_rm.meraki_organization_config_templates:
    organization_id: "organization_id_value"
    config:  # optional
      - config_template_id: "config_template_id_value"  # optional
        copy_from_network_id: "192.168.1.0/24"  # optional
        name: "example_name"  # optional
        product_types:  # optional
          - "product_types_item"
        time_zone: "time_zone_value"  # optional
    state: merged  # optional
- name: Meraki Organization Config Templates task
  cisco.meraki_rm.meraki_organization_config_templates:
    organization_id: "organization_id_value"  # (str, required) The organization ID.
    config:  # (list, optional) List of configuration template configurations.
      - config_template_id: "config_template_id_value"  # (str, optional) Server-assigned ID, resolved automatically by matching on...
        copy_from_network_id: "192.168.1.0/24"  # (str, optional) Network or template ID to copy configuration from.
        name: "example_name"  # (str, optional) Name of the configuration template.
        product_types:  # (list, optional) Product types (e.g. wireless, switch, appliance).
          - "product_types_item"
        time_zone: "time_zone_value"  # (str, optional) Timezone of the configuration template.
    state: merged  # (str, optional) The state of the resource.

Notes

  • Canonical key: name — identifies the resource in playbooks.
  • System key: config_template_id — server-assigned, resolved automatically from gathered state.
  • Users do not need to provide config_template_id unless disambiguating duplicate names.

Examples

Define Expected Configuration
- name: Define expected configuration
  ansible.builtin.set_fact:
    expected_config:
      name: Test-Config
      time_zone: example
      copy_from_network_id: example
Create Organization_config_templates With Merged State
- name: Create organization_config_templates with merged state
  cisco.meraki_rm.meraki_organization_config_templates:
    organization_id: "123456"
    state: merged
    config:
      - "{{ expected_config }}"
  register: merge_result
Assert Resource Was Created
- name: Assert resource was created
  ansible.builtin.assert:
    that:
      - merge_result is changed
      - merge_result.config | length == 1
Compare Expected Paths To Result (subset Check)
- 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 }}"
Assert All Expected Fields Are Present And Match
- 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 }}"
Task Output:
# Manage Meraki organization configuration templates — full resource replacement
Define Replacement Configuration
- name: Define replacement configuration
  ansible.builtin.set_fact:
    expected_config:
      name: Test-Config
      time_zone: example
      copy_from_network_id: example
Replace Organization_config_templates Configuration
- name: Replace organization_config_templates configuration
  cisco.meraki_rm.meraki_organization_config_templates:
    organization_id: "123456"
    state: replaced
    config:
      - "{{ expected_config }}"
  register: replace_result
Assert Resource Was Replaced
- name: Assert resource was replaced
  ansible.builtin.assert:
    that:
      - replace_result is changed
      - replace_result.config | length == 1
Compare Expected Paths To Result (subset Check)
- 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 }}"
Assert All Expected Fields Are Present And Match
- 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 }}"
Task Output:
# Manage Meraki organization configuration templates — override all instances # Ensures ONLY these resources exist; any not listed are deleted.
Define Desired-state Configuration
- name: Define desired-state configuration
  ansible.builtin.set_fact:
    expected_config:
      name: Test-Config
      time_zone: example
      copy_from_network_id: example
Override All Organization_config_templates — Desired State Only
- name: Override all organization_config_templates — desired state only
  cisco.meraki_rm.meraki_organization_config_templates:
    organization_id: "123456"
    state: overridden
    config:
      - "{{ expected_config }}"
  register: override_result
Assert Resources Were Overridden
- name: Assert resources were overridden
  ansible.builtin.assert:
    that:
      - override_result is changed
      - override_result.config | length == 1
Compare Expected Paths To Result (subset Check)
- 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 }}"
Assert All Expected Fields Are Present And Match
- 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 }}"
Task Output:
# Manage Meraki organization configuration templates — gather current configuration
Gather Current Organization_config_templates Configuration
- name: Gather current organization_config_templates configuration
  cisco.meraki_rm.meraki_organization_config_templates:
    organization_id: "123456"
    state: gathered
  register: gathered
Assert Gathered Config Is Not Empty
- 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"
Display Gathered Configuration
- name: Display gathered configuration
  ansible.builtin.debug:
    var: gathered.config
Task Output:
# Manage Meraki organization configuration templates — remove configuration
Define Resource To Delete
- name: Define resource to delete
  ansible.builtin.set_fact:
    expected_config:
      name: Test-Config
Delete Organization_config_templates Configuration
- name: Delete organization_config_templates configuration
  cisco.meraki_rm.meraki_organization_config_templates:
    organization_id: "123456"
    state: deleted
    config:
      - "{{ expected_config }}"
  register: delete_result
Assert Resource Was Deleted
- name: Assert resource was deleted
  ansible.builtin.assert:
    that:
      - delete_result is changed
      - delete_result is not failed
---
# Manage Meraki organization configuration templates — create or update

- name: Define expected configuration
  ansible.builtin.set_fact:
    expected_config:
      name: Test-Config
      time_zone: example
      copy_from_network_id: example

- name: Create organization_config_templates with merged state
  cisco.meraki_rm.meraki_organization_config_templates:
    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 configuration templates — full resource replacement

- name: Define replacement configuration
  ansible.builtin.set_fact:
    expected_config:
      name: Test-Config
      time_zone: example
      copy_from_network_id: example

- name: Replace organization_config_templates configuration
  cisco.meraki_rm.meraki_organization_config_templates:
    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 configuration templates — 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
      time_zone: example
      copy_from_network_id: example

- name: Override all organization_config_templates — desired state only
  cisco.meraki_rm.meraki_organization_config_templates:
    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 configuration templates — gather current configuration

- name: Gather current organization_config_templates configuration
  cisco.meraki_rm.meraki_organization_config_templates:
    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 configuration templates — remove configuration

- name: Define resource to delete
  ansible.builtin.set_fact:
    expected_config:
      name: Test-Config

- name: Delete organization_config_templates configuration
  cisco.meraki_rm.meraki_organization_config_templates:
    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

Return Values

config
list — returned: always
The resulting resource configuration.