networktocode.nautobot.custom_field module – Creates or removes custom fields from Nautobot
Note
This module is part of the networktocode.nautobot collection (version 5.2.0).
To install it, use: ansible-galaxy collection install networktocode.nautobot
.
You need further requirements to be able to use this module,
see Requirements for details.
To use it in a playbook, specify: networktocode.nautobot.custom_field
.
New in networktocode.nautobot 5.1.0
Synopsis
Creates or removes custom fields from Nautobot
Requirements
The below requirements are needed on the host that executes this module.
pynautobot
Parameters
Parameter |
Comments |
---|---|
Whether or not to display this field in the advanced tab Choices: |
|
API Version Nautobot REST API |
|
Content types that this field should be available for Required if state=present and the custom field does not exist yet |
|
Default value for this field when editing models Must be in JSON format |
|
Description of this field Also used as the help text when editing models using this custom field Markdown is supported |
|
Filter logic to apply when filtering models based on this field Only compatible with type=text, type=url and type=json Choices: |
|
Human-readable grouping that this custom field belongs to |
|
Internal name of this field Required if state=present and the custom field does not exist yet |
|
Name of the field as displayed to users |
|
This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined in plugins/module_utils/utils.py and provides control to users on what may make an object unique in their environment. |
|
Whether or not a value is required for this field when editing models Choices: |
|
Use Choices: |
|
The token created within Nautobot to authorize API access |
|
Data type of this field Required if state=present and the custom field does not exist yet type=select and type=multi-select require choices to be defined separately with the custom_field_choice module Choices: |
|
The URL of the Nautobot instance resolvable by the Ansible host (for example: http://nautobot.example.com:8000) |
|
If Default: :ansible-option-default:`true` |
|
Maximum value allowed for this field Only compatible with type=integer |
|
Minimum value allowed for this field Only compatible with type=integer |
|
Regular expression that this field must match Only compatible with type=text |
|
Position this field should be displayed in |
Notes
Note
This should be ran with connection
local
and hostslocalhost
Examples
- name: Create custom field within Nautobot with only required information
networktocode.nautobot.custom_field:
url: http://nautobot.local
token: thisIsMyToken
label: My Custom Field
key: my_custom_field
type: text
state: present
- name: Create custom field within Nautobot with all information
networktocode.nautobot.custom_field:
url: http://nautobot.local
token: thisIsMyToken
label: My Custom Field
grouping: My Grouping
key: my_custom_field
type: text
weight: 100
description: My Description
required: true
default: My Default
filter_logic: loose
advanced_ui: true
content_types:
- dcim.device
validation_minimum: 0
validation_maximum: 100
validation_regex: ^[a-z]+$
state: present
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
Serialized object as created or already existent within Nautobot Returned: success (when state=present) |
|
Message indicating failure or info about what has been achieved Returned: always |