Back to Ansible Reference

$ ansible-doc -t module cisco.sccfm.list_asa_compatible_versions

> MODULE cisco.sccfm.list_asa_compatible_versions (sccfm-ansible/plugins/modules/list_asa_compatible_versions.py)

  Queries compatible upgrade versions for one or more ASA devices
  managed by SCC Firewall Manager and computes the intersection of
  versions common to all selected devices.
  Uses the `GET
  /v1/inventory/devices/asas/{deviceUid}/upgrades/versions' API
  endpoint for each device, then returns the common set of versions
  that every device in the group can upgrade to.
  See
  https://developer.cisco.com/docs/cisco-security-cloud-control-firewall-manager/get-compatible-upgrade-versions-for-an-asa/
  for API documentation.

OPTIONS (= indicates it is required):

- api_token  API token for SCCFM.
        set_via:
          env:
          - name: SCCFM_API_TOKEN
        default: null
        no_log: true
        type: str

- limit   Maximum number of devices to return when using `query'.
           Ignored when using `uids'.
        default: 50
        type: int

- offset  Pagination offset when using `query'.
           Ignored when using `uids'.
        default: 0
        type: int

- per_device  Whether to include per-device version breakdown in the
               output.
               When false (default), single-device queries return a
               flat list and multi-device queries return only the
               common versions.
               When true, the full per-device breakdown is included
               alongside common versions.
        default: false
        type: bool

- query   Lucene query to filter ASA devices.
           Mutually exclusive with `uids'.
           The query is automatically combined with `deviceType:ASA'.
        default: null
        type: str

- region  SCCFM region (int, us, eu, apj, au, uae, in, or ci).
        set_via:
          env:
          - name: SCCFM_REGION
        default: null
        type: str

- uids    List of device UIDs to query.
           Mutually exclusive with `query'.
        default: null
        elements: str
        type: list

AUTHOR: Cisco SCCFM Team

EXAMPLES:
# Example 1: Get compatible versions for a single ASA (flat list output)
- name: Get compatible versions for a single ASA
  cisco.sccfm.list_asa_compatible_versions:
    uids:
      - "12345678-1234-1234-1234-123456789abc"
    region: "{{ sccfm_region }}"
    api_token: "{{ sccfm_api_token }}"
  register: compat_versions

- name: Show compatible versions
  ansible.builtin.debug:
    var: compat_versions.compatible_versions

# Example 2: Get common versions across a group (intersection)
- name: Get common compatible versions for specific ASAs
  cisco.sccfm.list_asa_compatible_versions:
    uids:
      - "12345678-1234-1234-1234-123456789abc"
      - "87654321-4321-4321-4321-cba987654321"
  register: compat_versions

- name: Show common versions
  ansible.builtin.debug:
    var: compat_versions.common_versions

# Example 3: Include per-device breakdown (opt-in)
- name: Get group versions with per-device details
  cisco.sccfm.list_asa_compatible_versions:
    uids:
      - "12345678-1234-1234-1234-123456789abc"
      - "87654321-4321-4321-4321-cba987654321"
    per_device: true
  register: compat_versions

- name: Show per-device counts
  ansible.builtin.debug:
    msg: "Device {{ item.key }}: {{ item.value | length }} version(s)"
  loop: "{{ compat_versions.per_device | dict2items }}"

# Example 4: Using module_defaults (recommended)
- name: List ASA compatible versions
  hosts: localhost
  gather_facts: false
  module_defaults:
    group/cisco.sccfm.all:
      region: "{{ sccfm_region }}"
      api_token: "{{ sccfm_api_token }}"
  tasks:
    - name: Get compatible versions for branch ASAs
      cisco.sccfm.list_asa_compatible_versions:
        query: "name:branch-*"
      register: compat_versions

RETURN VALUES:

- common_versions  Software versions compatible with every selected
                    ASA device. Returned for multi-device queries or
                    when `per_device' is true.
        elements: dict
        returned: success (multi-device or per_device=true)
        type: list

- compatible_versions  Flat list of compatible versions. Returned for
                        single-device queries when `per_device' is
                        false.
        elements: dict
        returned: success (single device, per_device=false)
        type: list

- device_count  Number of devices included in the query.
        returned: success (multi-device or per_device=true)
        type: int

- per_device  Per-device compatible version lists keyed by device
               UID.
        returned: success (only when per_device=true)
        type: dict