Back to Ansible Reference

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

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

  Update a network object in your SCC Firewall Manager tenant.
  The object can be identified by `uid' or `name' (exactly one
  required).
  Only fields that differ from the current state are sent, making the
  module idempotent.
  Returns `changed=False' when the object already matches the desired
  state.

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  New description for the network object.
        default: null
        type: str

- labels  New list of labels for the network object.
        default: null
        elements: str
        type: list

- name    Name of the network object to update (alternative to
           `uid'). Used to look up the object by name.
        default: null
        type: str

- new_name  New name for the network object (rename).
        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

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

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

- value   New 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').
        default: null
        type: str

AUTHOR: Cisco SCCFM Team

EXAMPLES:
# Example 1: Update a network object's value by UID
- name: Update network object value
  cisco.sccfm.update_network_object:
    uid: "abc-123-def"
    value: "192.168.1.0/24"
    region: "{{ sccfm_region }}"
    api_token: "{{ sccfm_api_token }}"

# Example 2: Rename a network object by name
- name: Rename a network object
  cisco.sccfm.update_network_object:
    name: old-object-name
    new_name: new-object-name
    region: "{{ sccfm_region }}"
    api_token: "{{ sccfm_api_token }}"

# Example 3: Update multiple fields using module_defaults
- name: Update 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: Update web server object
      cisco.sccfm.update_network_object:
        name: web-server-01
        value: "10.0.1.200"
        description: "Updated web server IP"
        labels:
          - production
          - web
        tags:
          environment:
            - production

# Example 4: Idempotent update (no change if already matching)
- name: Ensure network object has correct value
  cisco.sccfm.update_network_object:
    name: web-server-01
    value: "10.0.1.100"
  register: result

- name: Show whether a change was made
  ansible.builtin.debug:
    msg: "Changed: {{ result.changed }}"

RETURN VALUES:

- network_object  The updated network object, or current state if
                   unchanged.
                   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