.. Document meta :orphan: .. |antsibull-internal-nbsp| unicode:: 0xA0 :trim: .. meta:: :antsibull-docs: 2.13.1 .. Anchors .. _ansible_collections.netbox.netbox.netbox_inventory_item_module: .. Anchors: short name for ansible.builtin .. Title netbox.netbox.netbox_inventory_item module -- Creates or removes inventory items from NetBox ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ .. Collection note .. note:: This module is part of the `netbox.netbox collection `_ (version 3.21.0). It is not included in ``ansible-core``. To check whether it is installed, run :code:`ansible-galaxy collection list`. To install it, use: :code:`ansible-galaxy collection install netbox.netbox`. You need further requirements to be able to use this module, see :ref:`Requirements ` for details. To use it in a playbook, specify: :code:`netbox.netbox.netbox_inventory_item`. .. version_added .. rst-class:: ansible-version-added New in netbox.netbox 0.1.0 .. contents:: :local: :depth: 1 .. Deprecated Synopsis -------- .. Description - Creates or removes inventory items from NetBox .. Aliases .. Requirements .. _ansible_collections.netbox.netbox.netbox_inventory_item_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_inventory_item_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_inventory_item_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 inventory item configuration .. raw:: html
* - .. raw:: html
.. raw:: latex \hspace{0.02\textwidth}\begin{minipage}[t]{0.3\textwidth} .. _ansible_collections.netbox.netbox.netbox_inventory_item_module__parameter-data/asset_tag: .. rst-class:: ansible-option-title **asset_tag** .. raw:: html .. ansible-option-type-line:: :ansible-option-type:`string` .. raw:: html
.. raw:: latex \end{minipage} - .. raw:: html
The asset tag of the inventory item .. raw:: html
* - .. raw:: html
.. raw:: latex \hspace{0.02\textwidth}\begin{minipage}[t]{0.3\textwidth} .. _ansible_collections.netbox.netbox.netbox_inventory_item_module__parameter-data/component: .. rst-class:: ansible-option-title **component** .. raw:: html .. ansible-option-type-line:: :ansible-option-type:`dictionary` :ansible-option-versionadded:`added in netbox.netbox 3.15.0` .. raw:: html
.. raw:: latex \end{minipage} - .. raw:: html
The associated component .. raw:: html
* - .. raw:: html
.. raw:: latex \hspace{0.04\textwidth}\begin{minipage}[t]{0.28\textwidth} .. _ansible_collections.netbox.netbox.netbox_inventory_item_module__parameter-data/component/device: .. rst-class:: ansible-option-title **device** .. raw:: html .. ansible-option-type-line:: :ansible-option-type:`string` .. raw:: html
.. raw:: latex \end{minipage} - .. raw:: html
The device the component is attached to. .. raw:: html
* - .. raw:: html
.. raw:: latex \hspace{0.04\textwidth}\begin{minipage}[t]{0.28\textwidth} .. _ansible_collections.netbox.netbox.netbox_inventory_item_module__parameter-data/component/name: .. rst-class:: ansible-option-title **name** .. raw:: html .. ansible-option-type-line:: :ansible-option-type:`string` .. raw:: html
.. raw:: latex \end{minipage} - .. raw:: html
The name of the component .. raw:: html
* - .. raw:: html
.. raw:: latex \hspace{0.02\textwidth}\begin{minipage}[t]{0.3\textwidth} .. _ansible_collections.netbox.netbox.netbox_inventory_item_module__parameter-data/component_type: .. rst-class:: ansible-option-title **component_type** .. raw:: html .. ansible-option-type-line:: :ansible-option-type:`string` :ansible-option-versionadded:`added in netbox.netbox 3.15.0` .. raw:: html
.. raw:: latex \end{minipage} - .. raw:: html
The type of the component. Required if component is defined. .. rst-class:: ansible-option-line :ansible-option-choices:`Choices:` - :ansible-option-choices-entry:`"dcim.consoleport"` - :ansible-option-choices-entry:`"dcim.consoleserverport"` - :ansible-option-choices-entry:`"dcim.frontport"` - :ansible-option-choices-entry:`"dcim.interface"` - :ansible-option-choices-entry:`"dcim.poweroutlet"` - :ansible-option-choices-entry:`"dcim.powerport"` - :ansible-option-choices-entry:`"dcim.rearport"` .. raw:: html
* - .. raw:: html
.. raw:: latex \hspace{0.02\textwidth}\begin{minipage}[t]{0.3\textwidth} .. _ansible_collections.netbox.netbox.netbox_inventory_item_module__parameter-data/custom_fields: .. rst-class:: ansible-option-title **custom_fields** .. raw:: html .. ansible-option-type-line:: :ansible-option-type:`dictionary` :ansible-option-versionadded:`added in netbox.netbox 3.4.0` .. raw:: html
.. raw:: latex \end{minipage} - .. raw:: html
must exist in Netbox .. raw:: html
* - .. raw:: html
.. raw:: latex \hspace{0.02\textwidth}\begin{minipage}[t]{0.3\textwidth} .. _ansible_collections.netbox.netbox.netbox_inventory_item_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
The description of the inventory item .. raw:: html
* - .. raw:: html
.. raw:: latex \hspace{0.02\textwidth}\begin{minipage}[t]{0.3\textwidth} .. _ansible_collections.netbox.netbox.netbox_inventory_item_module__parameter-data/device: .. rst-class:: ansible-option-title **device** .. raw:: html .. ansible-option-type-line:: :ansible-option-type:`any` .. raw:: html
.. raw:: latex \end{minipage} - .. raw:: html
Name of the device the inventory item belongs to .. raw:: html
* - .. raw:: html
.. raw:: latex \hspace{0.02\textwidth}\begin{minipage}[t]{0.3\textwidth} .. _ansible_collections.netbox.netbox.netbox_inventory_item_module__parameter-data/discovered: .. rst-class:: ansible-option-title **discovered** .. raw:: html .. ansible-option-type-line:: :ansible-option-type:`boolean` .. raw:: html
.. raw:: latex \end{minipage} - .. raw:: html
Set the discovery flag for the inventory item .. rst-class:: ansible-option-line :ansible-option-choices:`Choices:` - :ansible-option-choices-entry-default:`false` :ansible-option-choices-default-mark:`← (default)` - :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_inventory_item_module__parameter-data/inventory_item_role: .. rst-class:: ansible-option-title **inventory_item_role** .. raw:: html .. ansible-option-type-line:: :ansible-option-type:`any` :ansible-option-versionadded:`added in netbox.netbox 3.14.0` .. raw:: html
.. raw:: latex \end{minipage} - .. raw:: html
Set the inventory item role .. raw:: html
* - .. raw:: html
.. raw:: latex \hspace{0.02\textwidth}\begin{minipage}[t]{0.3\textwidth} .. _ansible_collections.netbox.netbox.netbox_inventory_item_module__parameter-data/label: .. rst-class:: ansible-option-title **label** .. raw:: html .. ansible-option-type-line:: :ansible-option-type:`string` :ansible-option-versionadded:`added in netbox.netbox 3.4.0` .. raw:: html
.. raw:: latex \end{minipage} - .. raw:: html
The physical label of the inventory item .. raw:: html
* - .. raw:: html
.. raw:: latex \hspace{0.02\textwidth}\begin{minipage}[t]{0.3\textwidth} .. _ansible_collections.netbox.netbox.netbox_inventory_item_module__parameter-data/manufacturer: .. rst-class:: ansible-option-title **manufacturer** .. raw:: html .. ansible-option-type-line:: :ansible-option-type:`any` .. raw:: html
.. raw:: latex \end{minipage} - .. raw:: html
The manufacturer of the inventory item .. raw:: html
* - .. raw:: html
.. raw:: latex \hspace{0.02\textwidth}\begin{minipage}[t]{0.3\textwidth} .. _ansible_collections.netbox.netbox.netbox_inventory_item_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 inventory item to be created .. raw:: html
* - .. raw:: html
.. raw:: latex \hspace{0.02\textwidth}\begin{minipage}[t]{0.3\textwidth} .. _ansible_collections.netbox.netbox.netbox_inventory_item_module__parameter-data/parent_inventory_item: .. rst-class:: ansible-option-title **parent_inventory_item** .. raw:: html .. ansible-option-type-line:: :ansible-option-type:`any` :ansible-option-versionadded:`added in netbox.netbox 3.5.0` .. raw:: html
.. raw:: latex \end{minipage} - .. raw:: html
The parent inventory item the inventory item will be associated with .. raw:: html
* - .. raw:: html
.. raw:: latex \hspace{0.02\textwidth}\begin{minipage}[t]{0.3\textwidth} .. _ansible_collections.netbox.netbox.netbox_inventory_item_module__parameter-data/part_id: .. rst-class:: ansible-option-title **part_id** .. raw:: html .. ansible-option-type-line:: :ansible-option-type:`string` .. raw:: html
.. raw:: latex \end{minipage} - .. raw:: html
The part ID of the inventory item .. raw:: html
* - .. raw:: html
.. raw:: latex \hspace{0.02\textwidth}\begin{minipage}[t]{0.3\textwidth} .. _ansible_collections.netbox.netbox.netbox_inventory_item_module__parameter-data/serial: .. rst-class:: ansible-option-title **serial** .. raw:: html .. ansible-option-type-line:: :ansible-option-type:`string` .. raw:: html
.. raw:: latex \end{minipage} - .. raw:: html
The serial number of the inventory item .. raw:: html
* - .. raw:: html
.. raw:: latex \hspace{0.02\textwidth}\begin{minipage}[t]{0.3\textwidth} .. _ansible_collections.netbox.netbox.netbox_inventory_item_module__parameter-data/tags: .. rst-class:: ansible-option-title **tags** .. raw:: html .. ansible-option-type-line:: :ansible-option-type:`list` / :ansible-option-elements:`elements=any` .. raw:: html
.. raw:: latex \end{minipage} - .. raw:: html
Any tags that the device may need to be associated with .. raw:: html
* - .. raw:: html
.. _ansible_collections.netbox.netbox.netbox_inventory_item_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_inventory_item_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_inventory_item_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_inventory_item_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_inventory_item_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:: - Tags should be defined as a YAML list - This should be ran with connection :literal:`local` and hosts :literal:`localhost` .. Seealso .. Examples Examples -------- .. code-block:: yaml+jinja - name: "Test NetBox inventory_item module" connection: local hosts: localhost gather_facts: false tasks: - name: Create inventory item within NetBox with only required information netbox.netbox.netbox_inventory_item: netbox_url: http://netbox.local netbox_token: thisIsMyToken data: device: test100 name: "10G-SFP+" state: present - name: Update inventory item netbox.netbox.netbox_inventory_item: netbox_url: http://netbox.local netbox_token: thisIsMyToken data: device: test100 name: "10G-SFP+" manufacturer: "Cisco" part_id: "10G-SFP+" serial: "1234" asset_tag: "1234" description: "New SFP" inventory_item_role: NIC state: present - name: Create inventory item with parent netbox.netbox.netbox_inventory_item: netbox_url: http://netbox.local netbox_token: thisIsMyToken data: parent_inventory_item: name: "Line Card 1" device: test100 name: "10G-SFP+" device: test100 state: present - name: Create inventory item with component netbox.netbox.netbox_inventory_item: netbox_url: http://netbox.local netbox_token: thisIsMyToken data: name: "10G-SFP+" device: test100 component_type: "dcim.interface" component: name: GigabitEthernet2 device: "test100" state: present - name: Delete inventory item within netbox netbox.netbox.netbox_inventory_item: netbox_url: http://netbox.local netbox_token: thisIsMyToken data: device: test100 name: "10G-SFP+" 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_inventory_item_module__return-inventory_item: .. rst-class:: ansible-option-title **inventory_item** .. raw:: html .. ansible-option-type-line:: :ansible-option-type:`dictionary` .. raw:: html
- .. raw:: html
Serialized object as created or already existent within NetBox .. rst-class:: ansible-option-line :ansible-option-returned-bold:`Returned:` on creation .. raw:: html
* - .. raw:: html
.. _ansible_collections.netbox.netbox.netbox_inventory_item_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 ~~~~~~~ - Mikhail Yohman (@FragmentedPacket) .. 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