100%

meraki_camera_quality_retention_profiles

module
Manage Meraki camera quality retention profiles
Added in version 0.1.0

Synopsis

  • Manage Meraki camera quality retention profiles for a network.
  • Supports merged, replaced, deleted, and gathered states.

Author

Cisco Meraki

Parameters

config (list/dict)

List of quality retention profile configurations.

audio_recording_enabled (bool)

Enable audio recording.

cloud_archive_enabled (bool)

Enable cloud archive.

max_retention_days (int)

Maximum retention days for recordings.

motion_based_retention_enabled (bool)

Enable motion-based retention.

name (str)

Name of the quality retention profile.

quality_retention_profile_id (str)

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

Provide only to disambiguate when duplicate names exist.

restricted_bandwidth_mode_enabled (bool)

Enable restricted bandwidth mode.

schedule_id (str)

Schedule ID for recording.

smart_retention (dict)

Smart retention settings.

video_settings (dict)

Video quality and resolution settings per camera model.

network_id (str) required

The network 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 Camera Quality Retention Profiles task
  cisco.meraki_rm.meraki_camera_quality_retention_profiles:
    network_id: "192.168.1.0/24"
    config:
      - audio_recording_enabled: true
        cloud_archive_enabled: true
        max_retention_days: 0
        motion_based_retention_enabled: true
        name: "example_name"
        quality_retention_profile_id: "quality_retention_profile_id_value"
        restricted_bandwidth_mode_enabled: true
        schedule_id: "schedule_id_value"
        smart_retention: {}
        video_settings: {}
    state: merged
- name: Meraki Camera Quality Retention Profiles task
  cisco.meraki_rm.meraki_camera_quality_retention_profiles:
    network_id: "192.168.1.0/24"
    config:  # optional
      - audio_recording_enabled: true  # optional
        cloud_archive_enabled: true  # optional
        max_retention_days: 0  # optional
        motion_based_retention_enabled: true  # optional
        name: "example_name"  # optional
        quality_retention_profile_id: "quality_retention_profile_id_value"  # optional
        restricted_bandwidth_mode_enabled: true  # optional
        schedule_id: "schedule_id_value"  # optional
        smart_retention: {}  # optional
        video_settings: {}  # optional
    state: merged  # optional
- name: Meraki Camera Quality Retention Profiles task
  cisco.meraki_rm.meraki_camera_quality_retention_profiles:
    network_id: "192.168.1.0/24"  # (str, required) The network ID.
    config:  # (list, optional) List of quality retention profile configurations.
      - audio_recording_enabled: true  # (bool, optional) Enable audio recording.
        cloud_archive_enabled: true  # (bool, optional) Enable cloud archive.
        max_retention_days: 0  # (int, optional) Maximum retention days for recordings.
        motion_based_retention_enabled: true  # (bool, optional) Enable motion-based retention.
        name: "example_name"  # (str, optional) Name of the quality retention profile.
        quality_retention_profile_id: "quality_retention_profile_id_value"  # (str, optional) Server-assigned ID, resolved automatically by matching on...
        restricted_bandwidth_mode_enabled: true  # (bool, optional) Enable restricted bandwidth mode.
        schedule_id: "schedule_id_value"  # (str, optional) Schedule ID for recording.
        smart_retention: {}  # (dict, optional) Smart retention settings.
        video_settings: {}  # (dict, optional) Video quality and resolution settings per camera model.
    state: merged  # (str, optional) The state of the resource.

Notes

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

Examples

Define Expected Configuration
- name: Define expected configuration
  ansible.builtin.set_fact:
    expected_config:
      name: Test-Config
      max_retention_days: 30
      motion_based_retention_enabled: true
      restricted_bandwidth_mode_enabled: true
      audio_recording_enabled: true
      cloud_archive_enabled: true
      schedule_id: example
Create Camera_quality_retention_profiles With Merged State
- name: Create camera_quality_retention_profiles with merged state
  cisco.meraki_rm.meraki_camera_quality_retention_profiles:
    network_id: "N_123456789012345678"
    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 camera quality retention profiles — full resource replacement
Define Replacement Configuration
- name: Define replacement configuration
  ansible.builtin.set_fact:
    expected_config:
      name: Test-Config
      max_retention_days: 30
      motion_based_retention_enabled: true
      restricted_bandwidth_mode_enabled: true
      audio_recording_enabled: true
      cloud_archive_enabled: true
      schedule_id: example
Replace Camera_quality_retention_profiles Configuration
- name: Replace camera_quality_retention_profiles configuration
  cisco.meraki_rm.meraki_camera_quality_retention_profiles:
    network_id: "N_123456789012345678"
    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 camera quality retention profiles — 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
      max_retention_days: 30
      motion_based_retention_enabled: true
      restricted_bandwidth_mode_enabled: true
      audio_recording_enabled: true
      cloud_archive_enabled: true
      schedule_id: example
Override All Camera_quality_retention_profiles — Desired State Only
- name: Override all camera_quality_retention_profiles — desired state only
  cisco.meraki_rm.meraki_camera_quality_retention_profiles:
    network_id: "N_123456789012345678"
    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 camera quality retention profiles — gather current configuration
Gather Current Camera_quality_retention_profiles Configuration
- name: Gather current camera_quality_retention_profiles configuration
  cisco.meraki_rm.meraki_camera_quality_retention_profiles:
    network_id: "N_123456789012345678"
    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 camera quality retention profiles — remove configuration
Define Resource To Delete
- name: Define resource to delete
  ansible.builtin.set_fact:
    expected_config:
      name: Test-Config
Delete Camera_quality_retention_profiles Configuration
- name: Delete camera_quality_retention_profiles configuration
  cisco.meraki_rm.meraki_camera_quality_retention_profiles:
    network_id: "N_123456789012345678"
    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 camera quality retention profiles — create or update

- name: Define expected configuration
  ansible.builtin.set_fact:
    expected_config:
      name: Test-Config
      max_retention_days: 30
      motion_based_retention_enabled: true
      restricted_bandwidth_mode_enabled: true
      audio_recording_enabled: true
      cloud_archive_enabled: true
      schedule_id: example

- name: Create camera_quality_retention_profiles with merged state
  cisco.meraki_rm.meraki_camera_quality_retention_profiles:
    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 camera quality retention profiles — full resource replacement

- name: Define replacement configuration
  ansible.builtin.set_fact:
    expected_config:
      name: Test-Config
      max_retention_days: 30
      motion_based_retention_enabled: true
      restricted_bandwidth_mode_enabled: true
      audio_recording_enabled: true
      cloud_archive_enabled: true
      schedule_id: example

- name: Replace camera_quality_retention_profiles configuration
  cisco.meraki_rm.meraki_camera_quality_retention_profiles:
    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 camera quality retention profiles — 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
      max_retention_days: 30
      motion_based_retention_enabled: true
      restricted_bandwidth_mode_enabled: true
      audio_recording_enabled: true
      cloud_archive_enabled: true
      schedule_id: example

- name: Override all camera_quality_retention_profiles — desired state only
  cisco.meraki_rm.meraki_camera_quality_retention_profiles:
    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 camera quality retention profiles — gather current configuration

- name: Gather current camera_quality_retention_profiles configuration
  cisco.meraki_rm.meraki_camera_quality_retention_profiles:
    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 camera quality retention profiles — remove configuration

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

- name: Delete camera_quality_retention_profiles configuration
  cisco.meraki_rm.meraki_camera_quality_retention_profiles:
    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

Return Values

config
list — returned: always
The resulting resource configuration.