Back to Ansible Reference

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

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

  Create a network object in your SCC Firewall Manager tenant.
  Supports host IPs, CIDR subnets, and IP ranges as the object value.
  Idempotent — if a network object with the same name already exists,
  the module returns `ok' (changed=False) with the existing object.

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

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

= name    Name of the network object.
        type: str

- 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

= value   Literal value of the network object. Can be an IP address
           (e.g., `10.0.0.1'), a CIDR subnet (e.g., `10.0.0.0/24'), or
           an IP range (e.g., `10.0.0.1-10.0.0.10').
        type: str

AUTHOR: Cisco SCCFM Team

EXAMPLES:
# Example 1: Create a host network object
- name: Create a host network object
  cisco.sccfm.create_network_object:
    name: web-server-01
    value: "10.0.1.100"
    description: "Production web server"
    labels:
      - production
      - web
    region: "{{ sccfm_region }}"
    api_token: "{{ sccfm_api_token }}"

# Example 2: Create a subnet network object using module_defaults
- name: Create network objects
  hosts: localhost
  gather_facts: false
  module_defaults:
    group/cisco.sccfm.all:
      region: "{{ sccfm_region }}"
      api_token: "{{ lookup('env', 'SCCFM_API_TOKEN') }}"
  tasks:
    - name: Create branch office subnet
      cisco.sccfm.create_network_object:
        name: branch-office-subnet
        value: "10.10.0.0/24"
        description: "Branch office network"
        labels:
          - branch
          - subnet
        tags:
          environment:
            - production

# Example 3: Using environment variables (SCCFM_REGION and SCCFM_API_TOKEN)
- name: Create a range network object
  cisco.sccfm.create_network_object:
    name: dhcp-pool
    value: "192.168.1.100-192.168.1.200"
    description: "DHCP address pool"

RETURN VALUES:

- network_object  The created network object, or the existing object
                   if already present.
                   Returned keys include `uid', `name', `description',
                   `elements', `labels', `tags', `object_type', and
                   `literal'.
        returned: success
        type: dict
        contains:

        - labels  Labels attached to the object.
          type: list

        - literal  Literal value of the network object.
          type: str

        - name  Name of the network object.
          type: str

        - object_type  Type of the object.
          type: str

        - tags  Tags attached to the object.
          type: dict

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