Back to Ansible Reference

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

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

  List network groups from your SCC Firewall Manager tenant.
  Supports pagination via `limit' and `offset'.
  Supports Lucene query filtering via `query' (searchable fields:
  name, content).
  Only returns NETWORK_GROUP types.

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 results to return.
        default: 50
        type: int

- offset  Pagination offset (number of results to skip).
        default: 0
        type: int

- query   Optional Lucene query string to filter results. Searchable
           fields include `name' and `content'. Example: `name:web*'
           to find groups whose name starts with "web".
        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

AUTHOR: Cisco SCCFM Team

EXAMPLES:
# Example 1: List all network groups
- name: List all network groups
  cisco.sccfm.list_network_groups:
    region: "{{ sccfm_region }}"
    api_token: "{{ sccfm_api_token }}"
  register: result

- name: Display network groups
  ansible.builtin.debug:
    var: result.network_groups

# Example 2: Search with a query and pagination using module_defaults
- name: List network groups
  hosts: localhost
  gather_facts: false
  module_defaults:
    group/cisco.sccfm.all:
      region: "{{ sccfm_region }}"
      api_token: "{{ lookup('env', 'SCCFM_API_TOKEN') }}"
  tasks:
    - name: Find web-related network groups
      cisco.sccfm.list_network_groups:
        query: "name:web*"
        limit: 10
        offset: 0
      register: result

    - name: Show results
      ansible.builtin.debug:
        msg: "Found {{ result.count }} groups"

# Example 3: Using environment variables (SCCFM_REGION and SCCFM_API_TOKEN)
- name: List first page of network groups
  cisco.sccfm.list_network_groups:
    limit: 25
  register: result

RETURN VALUES:

- count   Total number of matching network groups.
        returned: success
        type: int

- limit   The limit used in the request.
        returned: success
        type: int

- network_groups  List of network groups returned by the API.
                   Each item can include `uid', `name', `description',
                   `elements', `labels', `tags', `object_type',
                   `literals', and `referenced_object_uids'.
        elements: dict
        returned: success
        type: list
        contains:

        - labels  Labels attached to the group.
          type: list

        - literals  Literal values in the network group.
          type: list

        - name  Name of the network group.
          type: str

        - object_type  Type of the object.
          type: str

        - referenced_object_uids  UIDs of referenced objects in the
                                   group.
          type: list

        - tags  Tags attached to the group.
          type: dict

        - uid  Unique identifier of the network group.
          type: str

- offset  The offset used in the request.
        returned: success
        type: int