Back to Ansible Reference

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

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

  Lists files on the disk0 partition of one or more ASA devices
  managed by SCC Firewall Manager.
  Executes `dir disk0:' on the target devices and parses the output
  into structured data with file-type classification (OS_IMAGE,
  ANYCONNECT_PACKAGE, ASDM_IMAGE, OTHER).
  Devices can be selected by a Lucene query or by specifying a list of
  UIDs.
  See
  https://developer.cisco.com/docs/cisco-security-cloud-control/execute-cli-command/
  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

- 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: List files on all production ASAs matching a query
- name: List disk files on production ASAs
  cisco.sccfm.list_asa_disk_files:
    query: "name:prod-* AND connectivityState:ONLINE"
    region: "{{ sccfm_region }}"
    api_token: "{{ sccfm_api_token }}"
  register: disk_files

# Example 2: List files on specific devices by UID
- name: List disk files on specific ASAs
  cisco.sccfm.list_asa_disk_files:
    uids:
      - "12345678-1234-1234-1234-123456789abc"
      - "87654321-4321-4321-4321-cba987654321"
  register: disk_files

# Example 3: Using module_defaults (recommended)
- name: List disk files
  hosts: localhost
  gather_facts: false
  module_defaults:
    group/cisco.sccfm.all:
      region: "{{ sccfm_region }}"
      api_token: "{{ sccfm_api_token }}"
  tasks:
    - name: List files on branch ASAs
      cisco.sccfm.list_asa_disk_files:
        query: "name:branch-*"
      register: disk_files

    - name: Show only AnyConnect packages
      ansible.builtin.debug:
        msg: "{{ disk_files.results | selectattr('file_type', 'equalto', 'ANYCONNECT_PACKAGE') | list }}"

RETURN VALUES:

- results  List of file entries found on the target device disks.
        elements: dict
        returned: success
        type: list
        contains:

        - date  The file date and time as reported by the device.
          type: str

        - device_uid  The UID of the device.
          type: str

        - file_name  The name of the file on disk.
          type: str

        - file_type  Classification of the file (OS_IMAGE,
                      ANYCONNECT_PACKAGE, ASDM_IMAGE, OTHER).
          type: str

        - size  The file size in bytes.
          type: int