Back to Ansible Reference

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

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

  Add one or more referenced network objects to an existing network
  group.
  The group can be identified by `uid' or `name' (exactly one
  required).
  Only referenced network-object members are supported by this module.
  Existing literals in the group are preserved unchanged.
  The module is idempotent and returns `changed=False' when all
  requested members are already present.

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 update.
        default: null
        type: str

= referenced_objects  List of existing network object names or UIDs
                       to add to the group. Names are resolved to UIDs
                       automatically.
        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

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

AUTHOR: Cisco SCCFM Team

EXAMPLES:
# Example 1: Add members by name
- name: Add members to a network group
  cisco.sccfm.add_network_group_members:
    name: web-servers
    referenced_objects:
      - web-server-01
      - web-server-02
    region: "{{ sccfm_region }}"
    api_token: "{{ sccfm_api_token }}"

# Example 2: Add members by UID
- name: Add members to a network group by UID
  cisco.sccfm.add_network_group_members:
    uid: "11111111-1111-1111-1111-111111111111"
    referenced_objects:
      - "22222222-2222-2222-2222-222222222222"
      - "33333333-3333-3333-3333-333333333333"

# Example 3: Using module_defaults (recommended)
- name: Add network group members
  hosts: localhost
  gather_facts: false
  module_defaults:
    group/cisco.sccfm.all:
      region: "{{ sccfm_region }}"
      api_token: "{{ sccfm_api_token }}"
  tasks:
    - name: Add web servers to group
      cisco.sccfm.add_network_group_members:
        name: web-servers
        referenced_objects:
          - web-server-01
          - web-server-02

RETURN VALUES:

- network_group  The resulting network group state.
                  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