` for details.
To use it in a playbook, specify: :code:`netbox.netbox.netbox_custom_field`.
.. version_added
.. rst-class:: ansible-version-added
New in netbox.netbox 3.6.0
.. contents::
:local:
:depth: 1
.. Deprecated
Synopsis
--------
.. Description
- Creates, updates or removes custom fields from NetBox
.. Aliases
.. Requirements
.. _ansible_collections.netbox.netbox.netbox_custom_field_module_requirements:
Requirements
------------
The below requirements are needed on the host that executes this module.
- pynetbox
.. Options
Parameters
----------
.. tabularcolumns:: \X{1}{3}\X{2}{3}
.. list-table::
:width: 100%
:widths: auto
:header-rows: 1
:class: longtable ansible-option-table
* - Parameter
- Comments
* - .. raw:: html
.. _ansible_collections.netbox.netbox.netbox_custom_field_module__parameter-cert:
.. rst-class:: ansible-option-title
**cert**
.. raw:: html
.. ansible-option-type-line::
:ansible-option-type:`any`
.. raw:: html
- .. raw:: html
Certificate path
.. raw:: html
* - .. raw:: html
.. _ansible_collections.netbox.netbox.netbox_custom_field_module__parameter-data:
.. rst-class:: ansible-option-title
**data**
.. raw:: html
.. ansible-option-type-line::
:ansible-option-type:`dictionary` / :ansible-option-required:`required`
.. raw:: html
- .. raw:: html
Defines the custom field
.. raw:: html
* - .. raw:: html
.. raw:: latex
\hspace{0.02\textwidth}\begin{minipage}[t]{0.3\textwidth}
.. _ansible_collections.netbox.netbox.netbox_custom_field_module__parameter-data/choice_set:
.. rst-class:: ansible-option-title
**choice_set**
.. raw:: html
.. ansible-option-type-line::
:ansible-option-type:`string`
.. raw:: html
.. raw:: latex
\end{minipage}
- .. raw:: html
The name of the choice set to use (for selection fields)
.. raw:: html
* - .. raw:: html
.. raw:: latex
\hspace{0.02\textwidth}\begin{minipage}[t]{0.3\textwidth}
.. _ansible_collections.netbox.netbox.netbox_custom_field_module__parameter-data/content_types:
.. rst-class:: ansible-option-title
**content_types**
.. raw:: html
.. ansible-option-type-line::
:ansible-option-type:`list` / :ansible-option-elements:`elements=any`
.. raw:: html
.. raw:: latex
\end{minipage}
- .. raw:: html
The content type(s) to apply this custom field to
.. raw:: html
* - .. raw:: html
.. raw:: latex
\hspace{0.02\textwidth}\begin{minipage}[t]{0.3\textwidth}
.. _ansible_collections.netbox.netbox.netbox_custom_field_module__parameter-data/default:
.. rst-class:: ansible-option-title
**default**
.. raw:: html
.. ansible-option-type-line::
:ansible-option-type:`any`
.. raw:: html
.. raw:: latex
\end{minipage}
- .. raw:: html
Default value of the custom field
.. raw:: html
* - .. raw:: html
.. raw:: latex
\hspace{0.02\textwidth}\begin{minipage}[t]{0.3\textwidth}
.. _ansible_collections.netbox.netbox.netbox_custom_field_module__parameter-data/description:
.. rst-class:: ansible-option-title
**description**
.. raw:: html
.. ansible-option-type-line::
:ansible-option-type:`string`
.. raw:: html
.. raw:: latex
\end{minipage}
- .. raw:: html
Description of the custom field
.. raw:: html
* - .. raw:: html
.. raw:: latex
\hspace{0.02\textwidth}\begin{minipage}[t]{0.3\textwidth}
.. _ansible_collections.netbox.netbox.netbox_custom_field_module__parameter-data/filter_logic:
.. rst-class:: ansible-option-title
**filter_logic**
.. raw:: html
.. ansible-option-type-line::
:ansible-option-type:`any`
.. raw:: html
.. raw:: latex
\end{minipage}
- .. raw:: html
Filter logic of the custom field
.. raw:: html
* - .. raw:: html
.. raw:: latex
\hspace{0.02\textwidth}\begin{minipage}[t]{0.3\textwidth}
.. _ansible_collections.netbox.netbox.netbox_custom_field_module__parameter-data/group_name:
.. rst-class:: ansible-option-title
**group_name**
.. raw:: html
.. ansible-option-type-line::
:ansible-option-type:`string`
:ansible-option-versionadded:`added in netbox.netbox 3.10.0`
.. raw:: html
.. raw:: latex
\end{minipage}
- .. raw:: html
The group to associate the custom field with
.. raw:: html
* - .. raw:: html
.. raw:: latex
\hspace{0.02\textwidth}\begin{minipage}[t]{0.3\textwidth}
.. _ansible_collections.netbox.netbox.netbox_custom_field_module__parameter-data/label:
.. rst-class:: ansible-option-title
**label**
.. raw:: html
.. ansible-option-type-line::
:ansible-option-type:`string`
.. raw:: html
.. raw:: latex
\end{minipage}
- .. raw:: html
Label of the custom field
.. raw:: html
* - .. raw:: html
.. raw:: latex
\hspace{0.02\textwidth}\begin{minipage}[t]{0.3\textwidth}
.. _ansible_collections.netbox.netbox.netbox_custom_field_module__parameter-data/name:
.. rst-class:: ansible-option-title
**name**
.. raw:: html
.. ansible-option-type-line::
:ansible-option-type:`string` / :ansible-option-required:`required`
.. raw:: html
.. raw:: latex
\end{minipage}
- .. raw:: html
Name of the custom field
.. raw:: html
* - .. raw:: html
.. raw:: latex
\hspace{0.02\textwidth}\begin{minipage}[t]{0.3\textwidth}
.. _ansible_collections.netbox.netbox.netbox_custom_field_module__parameter-data/object_type:
.. rst-class:: ansible-option-title
**object_type**
.. raw:: html
.. ansible-option-type-line::
:ansible-option-type:`string`
:ansible-option-versionadded:`added in netbox.netbox 3.7.0`
.. raw:: html
.. raw:: latex
\end{minipage}
- .. raw:: html
The object type of the custom field (if any)
.. raw:: html
* - .. raw:: html
.. raw:: latex
\hspace{0.02\textwidth}\begin{minipage}[t]{0.3\textwidth}
.. _ansible_collections.netbox.netbox.netbox_custom_field_module__parameter-data/object_types:
.. rst-class:: ansible-option-title
**object_types**
.. raw:: html
.. ansible-option-type-line::
:ansible-option-type:`list` / :ansible-option-elements:`elements=any`
:ansible-option-versionadded:`added in netbox.netbox 3.19.0`
.. raw:: html
.. raw:: latex
\end{minipage}
- .. raw:: html
The content type(s) to apply this custom field to (NetBox 4.0+)
.. raw:: html
* - .. raw:: html
.. raw:: latex
\hspace{0.02\textwidth}\begin{minipage}[t]{0.3\textwidth}
.. _ansible_collections.netbox.netbox.netbox_custom_field_module__parameter-data/related_object_type:
.. rst-class:: ansible-option-title
**related_object_type**
.. raw:: html
.. ansible-option-type-line::
:ansible-option-type:`string`
:ansible-option-versionadded:`added in netbox.netbox 3.20.0`
.. raw:: html
.. raw:: latex
\end{minipage}
- .. raw:: html
The object type of the custom field (if any) (NetBox 4.0+)
.. raw:: html
* - .. raw:: html
.. raw:: latex
\hspace{0.02\textwidth}\begin{minipage}[t]{0.3\textwidth}
.. _ansible_collections.netbox.netbox.netbox_custom_field_module__parameter-data/required:
.. rst-class:: ansible-option-title
**required**
.. raw:: html
.. ansible-option-type-line::
:ansible-option-type:`boolean`
.. raw:: html
.. raw:: latex
\end{minipage}
- .. raw:: html
Whether the custom field is required
.. rst-class:: ansible-option-line
:ansible-option-choices:`Choices:`
- :ansible-option-choices-entry:`false`
- :ansible-option-choices-entry:`true`
.. raw:: html
* - .. raw:: html
.. raw:: latex
\hspace{0.02\textwidth}\begin{minipage}[t]{0.3\textwidth}
.. _ansible_collections.netbox.netbox.netbox_custom_field_module__parameter-data/search_weight:
.. rst-class:: ansible-option-title
**search_weight**
.. raw:: html
.. ansible-option-type-line::
:ansible-option-type:`integer`
:ansible-option-versionadded:`added in netbox.netbox 3.10.0`
.. raw:: html
.. raw:: latex
\end{minipage}
- .. raw:: html
Weighting for search. Lower values are considered more important. Fields with a search weight of zero will be ignored.
.. raw:: html
* - .. raw:: html
.. raw:: latex
\hspace{0.02\textwidth}\begin{minipage}[t]{0.3\textwidth}
.. _ansible_collections.netbox.netbox.netbox_custom_field_module__parameter-data/type:
.. rst-class:: ansible-option-title
**type**
.. raw:: html
.. ansible-option-type-line::
:ansible-option-type:`string`
.. raw:: html
.. raw:: latex
\end{minipage}
- .. raw:: html
The type of custom field
.. rst-class:: ansible-option-line
:ansible-option-choices:`Choices:`
- :ansible-option-choices-entry:`"text"`
- :ansible-option-choices-entry:`"longtext"`
- :ansible-option-choices-entry:`"integer"`
- :ansible-option-choices-entry:`"decimal"`
- :ansible-option-choices-entry:`"boolean"`
- :ansible-option-choices-entry:`"date"`
- :ansible-option-choices-entry:`"datetime"`
- :ansible-option-choices-entry:`"url"`
- :ansible-option-choices-entry:`"json"`
- :ansible-option-choices-entry:`"select"`
- :ansible-option-choices-entry:`"multiselect"`
- :ansible-option-choices-entry:`"object"`
- :ansible-option-choices-entry:`"multiobject"`
.. raw:: html
* - .. raw:: html
.. raw:: latex
\hspace{0.02\textwidth}\begin{minipage}[t]{0.3\textwidth}
.. _ansible_collections.netbox.netbox.netbox_custom_field_module__parameter-data/ui_visibility:
.. rst-class:: ansible-option-title
**ui_visibility**
.. raw:: html
.. ansible-option-type-line::
:ansible-option-type:`string`
:ansible-option-versionadded:`added in netbox.netbox 3.10.0`
.. raw:: html
.. raw:: latex
\end{minipage}
- .. raw:: html
The UI visibility of the custom field
.. rst-class:: ansible-option-line
:ansible-option-choices:`Choices:`
- :ansible-option-choices-entry:`"read-write"`
- :ansible-option-choices-entry:`"read-only"`
- :ansible-option-choices-entry:`"hidden"`
- :ansible-option-choices-entry:`"hidden-ifunset"`
.. raw:: html
* - .. raw:: html
.. raw:: latex
\hspace{0.02\textwidth}\begin{minipage}[t]{0.3\textwidth}
.. _ansible_collections.netbox.netbox.netbox_custom_field_module__parameter-data/validation_maximum:
.. rst-class:: ansible-option-title
**validation_maximum**
.. raw:: html
.. ansible-option-type-line::
:ansible-option-type:`integer`
.. raw:: html
.. raw:: latex
\end{minipage}
- .. raw:: html
The maximum allowed value (for numeric fields)
.. raw:: html
* - .. raw:: html
.. raw:: latex
\hspace{0.02\textwidth}\begin{minipage}[t]{0.3\textwidth}
.. _ansible_collections.netbox.netbox.netbox_custom_field_module__parameter-data/validation_minimum:
.. rst-class:: ansible-option-title
**validation_minimum**
.. raw:: html
.. ansible-option-type-line::
:ansible-option-type:`integer`
.. raw:: html
.. raw:: latex
\end{minipage}
- .. raw:: html
The minimum allowed value (for numeric fields)
.. raw:: html
* - .. raw:: html
.. raw:: latex
\hspace{0.02\textwidth}\begin{minipage}[t]{0.3\textwidth}
.. _ansible_collections.netbox.netbox.netbox_custom_field_module__parameter-data/validation_regex:
.. rst-class:: ansible-option-title
**validation_regex**
.. raw:: html
.. ansible-option-type-line::
:ansible-option-type:`string`
.. raw:: html
.. raw:: latex
\end{minipage}
- .. raw:: html
The regular expression to enforce on text fields
.. raw:: html
* - .. raw:: html
.. raw:: latex
\hspace{0.02\textwidth}\begin{minipage}[t]{0.3\textwidth}
.. _ansible_collections.netbox.netbox.netbox_custom_field_module__parameter-data/weight:
.. rst-class:: ansible-option-title
**weight**
.. raw:: html
.. ansible-option-type-line::
:ansible-option-type:`integer`
.. raw:: html
.. raw:: latex
\end{minipage}
- .. raw:: html
Fields with higher weights appear lower in a form
.. raw:: html
* - .. raw:: html
.. _ansible_collections.netbox.netbox.netbox_custom_field_module__parameter-netbox_token:
.. rst-class:: ansible-option-title
**netbox_token**
.. raw:: html
.. ansible-option-type-line::
:ansible-option-type:`string` / :ansible-option-required:`required`
.. raw:: html
- .. raw:: html
The NetBox API token.
.. raw:: html
* - .. raw:: html
.. _ansible_collections.netbox.netbox.netbox_custom_field_module__parameter-netbox_url:
.. rst-class:: ansible-option-title
**netbox_url**
.. raw:: html
.. ansible-option-type-line::
:ansible-option-type:`string` / :ansible-option-required:`required`
.. raw:: html
- .. raw:: html
The URL of the NetBox instance.
Must be accessible by the Ansible control host.
.. raw:: html
* - .. raw:: html
.. _ansible_collections.netbox.netbox.netbox_custom_field_module__parameter-query_params:
.. rst-class:: ansible-option-title
**query_params**
.. raw:: html
.. ansible-option-type-line::
:ansible-option-type:`list` / :ansible-option-elements:`elements=string`
.. raw:: html
- .. raw:: html
This can be used to override the specified values in ALLOWED\_QUERY\_PARAMS that are defined
in plugins/module\_utils/netbox\_utils.py and provides control to users on what may make
an object unique in their environment.
.. raw:: html
* - .. raw:: html
.. _ansible_collections.netbox.netbox.netbox_custom_field_module__parameter-state:
.. rst-class:: ansible-option-title
**state**
.. raw:: html
.. ansible-option-type-line::
:ansible-option-type:`string`
.. raw:: html
- .. raw:: html
The state of the object.
.. rst-class:: ansible-option-line
:ansible-option-choices:`Choices:`
- :ansible-option-choices-entry-default:`"present"` :ansible-option-choices-default-mark:`← (default)`
- :ansible-option-choices-entry:`"absent"`
.. raw:: html
* - .. raw:: html
.. _ansible_collections.netbox.netbox.netbox_custom_field_module__parameter-validate_certs:
.. rst-class:: ansible-option-title
**validate_certs**
.. raw:: html
.. ansible-option-type-line::
:ansible-option-type:`any`
.. raw:: html
- .. raw:: html
If :literal:`no`\ , SSL certificates will not be validated.
This should only be used on personally controlled sites using a self-signed certificates.
.. rst-class:: ansible-option-line
:ansible-option-default-bold:`Default:` :ansible-option-default:`true`
.. raw:: html
.. Attributes
.. Notes
Notes
-----
.. note::
- This should be ran with connection :literal:`local` and hosts :literal:`localhost`
.. Seealso
.. Examples
Examples
--------
.. code-block:: yaml+jinja
- name: "Test NetBox custom_fields module"
connection: local
hosts: localhost
tasks:
- name: Create a custom field on device and virtual machine
netbox.netbox.netbox_custom_field:
netbox_url: http://netbox.local
netbox_token: thisIsMyToken
data:
content_types:
- dcim.device
- virtualization.virtualmachine
name: A Custom Field
type: text
- name: Create a custom field of type selection
netbox.netbox.netbox_custom_field:
netbox_url: http://netbox.local
netbox_token: thisIsMyToken
data:
name: "Custom_Field"
content_types:
- dcim.device
- virtualization.virtualmachine
type: select
choice_set: A Choice Set name
- name: Update the custom field to make it required
netbox.netbox.netbox_custom_field:
netbox_url: http://netbox.local
netbox_token: thisIsMyToken
data:
name: A Custom Field
required: true
- name: Update the custom field to make it read only
netbox.netbox.netbox_custom_field:
netbox_url: http://netbox.local
netbox_token: thisIsMyToken
data:
name: A Custom Field
ui_visibility: read-only
- name: Delete the custom field
netbox.netbox.netbox_custom_field:
netbox_url: http://netbox.local
netbox_token: thisIsMyToken
data:
name: A Custom Field
state: absent
.. Facts
.. Return values
Return Values
-------------
Common return values are documented :ref:`here `, the following are the fields unique to this module:
.. tabularcolumns:: \X{1}{3}\X{2}{3}
.. list-table::
:width: 100%
:widths: auto
:header-rows: 1
:class: longtable ansible-option-table
* - Key
- Description
* - .. raw:: html
.. _ansible_collections.netbox.netbox.netbox_custom_field_module__return-custom_field:
.. rst-class:: ansible-option-title
**custom_field**
.. raw:: html
.. ansible-option-type-line::
:ansible-option-type:`dictionary`
.. raw:: html
- .. raw:: html
Serialized object as created/existent/updated/deleted within NetBox
.. rst-class:: ansible-option-line
:ansible-option-returned-bold:`Returned:` always
.. raw:: html
* - .. raw:: html
.. _ansible_collections.netbox.netbox.netbox_custom_field_module__return-msg:
.. rst-class:: ansible-option-title
**msg**
.. raw:: html
.. ansible-option-type-line::
:ansible-option-type:`string`
.. raw:: html
- .. raw:: html
Message indicating failure or info about what has been achieved
.. rst-class:: ansible-option-line
:ansible-option-returned-bold:`Returned:` always
.. raw:: html
.. Status (Presently only deprecated)
.. Authors
Authors
~~~~~~~
- Martin Rødvand (@rodvand)
.. Extra links
Collection links
~~~~~~~~~~~~~~~~
.. ansible-links::
- title: "Issue Tracker"
url: "https://github.com/netbox-community/ansible_modules/issues"
external: true
- title: "Repository (Sources)"
url: "https://github.com/netbox-community/ansible_modules"
external: true
.. Parsing errors