Back to Ansible Reference

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

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

  Delete a network group object from your SCC Firewall Manager tenant.
  Groups can be deleted by either UID or name.
  This module is idempotent; deleting a non-existent group returns
  changed=false.

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

- name    Name of the network group to delete.
        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

- uid     Unique identifier (UID) of the network group to delete.
        default: null
        type: str

NOTES:
      * Either `uid' or `name' must be provided, but not both.
      * When using `name', the module will search for the group
        and resolve it to a UID before deletion.
      * Network groups are filtered by objectType to avoid
        accidentally matching network objects with the same
        name.

AUTHOR: Cisco SCCFM Team

EXAMPLES:
# Example 1: Delete a network group by UID
- name: Delete network group by UID
  cisco.sccfm.delete_network_group:
    uid: "abc-123-def-456"
    region: "{{ sccfm_region }}"
    api_token: "{{ sccfm_api_token }}"

# Example 2: Delete a network group by name
- name: Delete network group by name
  cisco.sccfm.delete_network_group:
    name: "web-server-group"
    region: "{{ sccfm_region }}"
    api_token: "{{ sccfm_api_token }}"

# Example 3: Delete multiple groups using module_defaults
- name: Delete 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: Delete obsolete network groups
      cisco.sccfm.delete_network_group:
        name: "{{ item }}"
      loop:
        - web-server-group-01
        - web-subnet-group

# Example 4: Using environment variables (SCCFM_REGION and SCCFM_API_TOKEN)
- name: Delete a network group
  cisco.sccfm.delete_network_group:
    name: "temporary-group"

RETURN VALUES:

- deleted_uid  The UID of the deleted network group, or null if
                already absent.
        returned: always
        sample: abc-123-def-456
        type: str