Skip to content

Netbox custom field related object filter #1423

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: devel
Choose a base branch
from

Conversation

yodzeb
Copy link
Contributor

@yodzeb yodzeb commented Jun 6, 2025

Related Issue

Not tracked

New Behavior

Support for extra parameter "related_objet_filter" allowing to set a filter for related object, allowed when type=object

Filter is passed as a dict in the task:

    - name: create custom fields
      netbox.netbox.netbox_custom_field:
        netbox_url: "{{ netbox_url }}"
        netbox_token: "{{ netbox_token }}"
        data:
          name: "TEST_CF"
          object_types: ipam.prefix
          type: object
          related_object_type: ipam.prefix
          related_object_filter:
            tags: xx
        state: present
      delegate_to: localhost

Contrast to Current Behavior

This parameter wasn't supported

Discussion: Benefits and Drawbacks

I've noticed the reset of this param on the target objet must be done by passing an empty dict like "{{ {} }}". Setting it to null seems to be ignored by the API.

Like other data-dependent parameters, we rely on the remote API for asserting we can or connot use this paramater (this param is only allowed for type=object for instance)

Changes to the Documentation

Should be transparent

Proposed Release Note Entry

See fragment

Double Check

  • I have read the comments and followed the CONTRIBUTING.md.
  • I have explained my PR according to the information in the comments or in a linked issue.
  • My PR targets the devel branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant