Back to Ansible Reference

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

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

  Create a network group in your SCC Firewall Manager tenant.
  A group can contain network literals, URL literals, and/or
  referenced objects.
  Network literals and URL literals are mutually exclusive.
  Idempotent — if a network group with the same name already exists,
  the module returns `ok' (changed=False) with the existing group.

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

- description  Optional description for the network group.
        default: null
        type: str

- labels  List of labels to attach to the network group.
        default: null
        elements: str
        type: list

= name    Name of the network group.
        type: str

- network_literals  List of network literal values (IP addresses,
                     CIDR subnets, or IP ranges). Mutually exclusive
                     with `url_literals'.
        default: null
        elements: str
        type: list

- referenced_objects  List of existing network object names or UIDs
                       to include in the group. Names are resolved to
                       UIDs automatically.
        default: null
        elements: str
        type: list

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

- tags    Mapping of tag keys to lists of tag values. For example,
           `{"environment": ["production", "staging"]}'.
        default: null
        type: dict

- url_literals  List of URL literal values. Mutually exclusive with
                 `network_literals'.
        default: null
        elements: str
        type: list

AUTHOR: Cisco SCCFM Team

EXAMPLES:
# Example 1: Create a group with network literals
- name: Create a network group with literals
  cisco.sccfm.create_network_group:
    name: web-servers
    network_literals:
      - "10.0.1.100"
      - "10.0.1.101"
    description: "Web server group"
    labels:
      - production
      - web
    region: "{{ sccfm_region }}"
    api_token: "{{ sccfm_api_token }}"

# Example 2: Create a group with referenced objects using module_defaults
- name: Create 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: Create group from existing objects
      cisco.sccfm.create_network_group:
        name: app-tier
        referenced_objects:
          - web-server-01
          - app-server-01
        description: "Application tier group"
        tags:
          environment:
            - production

# Example 3: Using environment variables (SCCFM_REGION and SCCFM_API_TOKEN)
- name: Create a group with URL literals
  cisco.sccfm.create_network_group:
    name: trusted-urls
    url_literals:
      - "https://example.com"
      - "https://api.example.com"
    description: "Trusted URL group"

RETURN VALUES:

- network_group  The created network group.
                  Returned keys include `uid', `name', `description',
                  `elements', `labels', `tags', `object_type',
                  `literals', and `referenced_object_uids'.
        returned: success
        type: dict
        contains:

        - labels  Labels attached to the group.
          type: list

        - literals  Literal values in the 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