Skip to content

[Bug]: netbox_service module #1426

@yodzeb

Description

@yodzeb

Ansible NetBox Collection version

v3.21.0

Ansible version

using this task:

    - name: Create service
      netbox.netbox.netbox_service:
        netbox_url: "{{ netbox_url }}"
        netbox_token: "{{ netbox_token }}"
        data:
          device: mydevice
          name: ServiceX
          ports: 9100
          protocol: TCP
          ipaddresses:
            - address: 10.1.0.1
        state: present

Produces this output:

TASK [Create service] ***********************************************************************************************************************************************************************************************************************
fatal: [localhost]: FAILED! => {"changed": false, "msg": "{\"parent_object_type\":[\"This field is required.\"],\"parent_object_id\":[\"This field is required.\"]}"}

Another error appears when setting a virtual_machine instead of a device:

TASK [Create service] ***********************************************************************************************************************************************************************************************************************
fatal: [localhost]: FAILED! => {"changed": false, "msg": "virtual_machine does not exist on existing object. Check to make sure valid field."}

NetBox version

NetBox Community v4.3.1-Docker-3.3.0 (2025-05-13)

Python version

3.11

Steps to Reproduce

See description

Expected Behavior

Proper parameters mapping between Ansible module & the API.

Observed Behavior

missing required API parameters or parameters mapping.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions