.. Document meta :orphan: .. |antsibull-internal-nbsp| unicode:: 0xA0 :trim: .. meta:: :antsibull-docs: 2.16.2 .. Anchors .. _ansible_collections.netbox.netbox.netbox_ip_address_module: .. Anchors: short name for ansible.builtin .. Title netbox.netbox.netbox_ip_address module -- Creates or removes IP addresses from NetBox +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ .. Collection note .. note:: This module is part of the `netbox.netbox collection `_ (version 3.23.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_ip_address`. .. version_added .. rst-class:: ansible-version-added New in netbox.netbox 0.1.0 .. contents:: :local: :depth: 1 .. Deprecated Synopsis -------- .. Description - Creates or removes IP addresses from NetBox .. Aliases .. Requirements .. _ansible_collections.netbox.netbox.netbox_ip_address_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_ip_address_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_ip_address_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 IP address configuration .. raw:: html
* - .. raw:: html
.. raw:: latex \hspace{0.02\textwidth}\begin{minipage}[t]{0.3\textwidth} .. _ansible_collections.netbox.netbox.netbox_ip_address_module__parameter-data/address: .. rst-class:: ansible-option-title **address** .. raw:: html .. ansible-option-type-line:: :ansible-option-type:`string` .. raw:: html
.. raw:: latex \end{minipage} - .. raw:: html
Required if state is :literal:`present` .. raw:: html
* - .. raw:: html
.. raw:: latex \hspace{0.02\textwidth}\begin{minipage}[t]{0.3\textwidth} .. _ansible_collections.netbox.netbox.netbox_ip_address_module__parameter-data/assigned_object: .. rst-class:: ansible-option-title **assigned_object** .. raw:: html .. ansible-option-type-line:: :ansible-option-type:`dictionary` .. raw:: html
.. raw:: latex \end{minipage} - .. raw:: html
Definition of the assigned object. .. raw:: html
* - .. raw:: html
.. raw:: latex \hspace{0.04\textwidth}\begin{minipage}[t]{0.28\textwidth} .. _ansible_collections.netbox.netbox.netbox_ip_address_module__parameter-data/assigned_object/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 interface is attached to. .. raw:: html
* - .. raw:: html
.. raw:: latex \hspace{0.04\textwidth}\begin{minipage}[t]{0.28\textwidth} .. _ansible_collections.netbox.netbox.netbox_ip_address_module__parameter-data/assigned_object/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 interface .. raw:: html
* - .. raw:: html
.. raw:: latex \hspace{0.04\textwidth}\begin{minipage}[t]{0.28\textwidth} .. _ansible_collections.netbox.netbox.netbox_ip_address_module__parameter-data/assigned_object/virtual_machine: .. rst-class:: ansible-option-title **virtual_machine** .. raw:: html .. ansible-option-type-line:: :ansible-option-type:`string` .. raw:: html
.. raw:: latex \end{minipage} - .. raw:: html
The virtual machine the interface is attached to. .. raw:: html
* - .. raw:: html
.. raw:: latex \hspace{0.02\textwidth}\begin{minipage}[t]{0.3\textwidth} .. _ansible_collections.netbox.netbox.netbox_ip_address_module__parameter-data/comments: .. rst-class:: ansible-option-title **comments** .. 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
Comments that may include additional information in regards to the IP Address .. raw:: html
* - .. raw:: html
.. raw:: latex \hspace{0.02\textwidth}\begin{minipage}[t]{0.3\textwidth} .. _ansible_collections.netbox.netbox.netbox_ip_address_module__parameter-data/custom_fields: .. rst-class:: ansible-option-title **custom_fields** .. raw:: html .. ansible-option-type-line:: :ansible-option-type:`dictionary` .. 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_ip_address_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 interface .. raw:: html
* - .. raw:: html
.. raw:: latex \hspace{0.02\textwidth}\begin{minipage}[t]{0.3\textwidth} .. _ansible_collections.netbox.netbox.netbox_ip_address_module__parameter-data/dns_name: .. rst-class:: ansible-option-title **dns_name** .. raw:: html .. ansible-option-type-line:: :ansible-option-type:`string` .. raw:: html
.. raw:: latex \end{minipage} - .. raw:: html
Hostname or FQDN .. raw:: html
* - .. raw:: html
.. raw:: latex \hspace{0.02\textwidth}\begin{minipage}[t]{0.3\textwidth} .. _ansible_collections.netbox.netbox.netbox_ip_address_module__parameter-data/family: .. rst-class:: ansible-option-title **family** .. raw:: html .. ansible-option-type-line:: :ansible-option-type:`integer` .. raw:: html
.. raw:: latex \end{minipage} - .. raw:: html
(DEPRECATED) - NetBox now handles determining the IP family natively. Specifies with address family the IP address belongs to .. rst-class:: ansible-option-line :ansible-option-choices:`Choices:` - :ansible-option-choices-entry:`4` - :ansible-option-choices-entry:`6` .. raw:: html
* - .. raw:: html
.. raw:: latex \hspace{0.02\textwidth}\begin{minipage}[t]{0.3\textwidth} .. _ansible_collections.netbox.netbox.netbox_ip_address_module__parameter-data/interface: .. rst-class:: ansible-option-title **interface** .. raw:: html .. ansible-option-type-line:: :ansible-option-type:`any` .. raw:: html
.. raw:: latex \end{minipage} - .. raw:: html
The name and device of the interface that the IP address should be assigned to Required if state is :literal:`present` and a prefix specified. .. raw:: html
* - .. raw:: html
.. raw:: latex \hspace{0.02\textwidth}\begin{minipage}[t]{0.3\textwidth} .. _ansible_collections.netbox.netbox.netbox_ip_address_module__parameter-data/nat_inside: .. rst-class:: ansible-option-title **nat_inside** .. raw:: html .. ansible-option-type-line:: :ansible-option-type:`any` .. raw:: html
.. raw:: latex \end{minipage} - .. raw:: html
The inside IP address this IP is assigned to .. raw:: html
* - .. raw:: html
.. raw:: latex \hspace{0.02\textwidth}\begin{minipage}[t]{0.3\textwidth} .. _ansible_collections.netbox.netbox.netbox_ip_address_module__parameter-data/prefix: .. rst-class:: ansible-option-title **prefix** .. raw:: html .. ansible-option-type-line:: :ansible-option-type:`any` .. raw:: html
.. raw:: latex \end{minipage} - .. raw:: html
With state :literal:`present`\ , if an interface is given, it will ensure that an IP inside this prefix (and vrf, if given) is attached to this interface. Otherwise, it will get the next available IP of this prefix and attach it. With state :literal:`new`\ , it will force to get the next available IP in this prefix. If an interface is given, it will also force to attach it. Required if state is :literal:`present` or :literal:`new` when no address is given. Unused if an address is specified. .. raw:: html
* - .. raw:: html
.. raw:: latex \hspace{0.02\textwidth}\begin{minipage}[t]{0.3\textwidth} .. _ansible_collections.netbox.netbox.netbox_ip_address_module__parameter-data/role: .. rst-class:: ansible-option-title **role** .. raw:: html .. ansible-option-type-line:: :ansible-option-type:`string` .. raw:: html
.. raw:: latex \end{minipage} - .. raw:: html
The role of the IP address .. rst-class:: ansible-option-line :ansible-option-choices:`Choices:` - :ansible-option-choices-entry:`"Loopback"` - :ansible-option-choices-entry:`"Secondary"` - :ansible-option-choices-entry:`"Anycast"` - :ansible-option-choices-entry:`"VIP"` - :ansible-option-choices-entry:`"VRRP"` - :ansible-option-choices-entry:`"HSRP"` - :ansible-option-choices-entry:`"GLBP"` - :ansible-option-choices-entry:`"CARP"` .. raw:: html
* - .. raw:: html
.. raw:: latex \hspace{0.02\textwidth}\begin{minipage}[t]{0.3\textwidth} .. _ansible_collections.netbox.netbox.netbox_ip_address_module__parameter-data/status: .. rst-class:: ansible-option-title **status** .. raw:: html .. ansible-option-type-line:: :ansible-option-type:`any` .. raw:: html
.. raw:: latex \end{minipage} - .. raw:: html
The status of the IP address .. raw:: html
* - .. raw:: html
.. raw:: latex \hspace{0.02\textwidth}\begin{minipage}[t]{0.3\textwidth} .. _ansible_collections.netbox.netbox.netbox_ip_address_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 IP address may need to be associated with .. raw:: html
* - .. raw:: html
.. raw:: latex \hspace{0.02\textwidth}\begin{minipage}[t]{0.3\textwidth} .. _ansible_collections.netbox.netbox.netbox_ip_address_module__parameter-data/tenant: .. rst-class:: ansible-option-title **tenant** .. raw:: html .. ansible-option-type-line:: :ansible-option-type:`any` .. raw:: html
.. raw:: latex \end{minipage} - .. raw:: html
The tenant that the device will be assigned to .. raw:: html
* - .. raw:: html
.. raw:: latex \hspace{0.02\textwidth}\begin{minipage}[t]{0.3\textwidth} .. _ansible_collections.netbox.netbox.netbox_ip_address_module__parameter-data/vrf: .. rst-class:: ansible-option-title **vrf** .. raw:: html .. ansible-option-type-line:: :ansible-option-type:`any` .. raw:: html
.. raw:: latex \end{minipage} - .. raw:: html
VRF that IP address is associated with .. raw:: html
* - .. raw:: html
.. _ansible_collections.netbox.netbox.netbox_ip_address_module__parameter-headers: .. rst-class:: ansible-option-title **headers** .. raw:: html .. ansible-option-type-line:: :ansible-option-type:`dictionary` .. raw:: html
- .. raw:: html
Dictionary of headers to be passed to the NetBox API. .. raw:: html
* - .. raw:: html
.. _ansible_collections.netbox.netbox.netbox_ip_address_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_ip_address_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_ip_address_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_ip_address_module__parameter-state: .. rst-class:: ansible-option-title **state** .. raw:: html .. ansible-option-type-line:: :ansible-option-type:`string` .. raw:: html
- .. raw:: html
Use :literal:`present`\ , :literal:`new` or :literal:`absent` for adding, force adding or removing. :literal:`present` will check if the IP is already created, and return it if true. :literal:`new` will force to create it anyway (useful for anycasts, for example). .. rst-class:: ansible-option-line :ansible-option-choices:`Choices:` - :ansible-option-choices-entry:`"absent"` - :ansible-option-choices-entry:`"new"` - :ansible-option-choices-entry-default:`"present"` :ansible-option-choices-default-mark:`← (default)` .. raw:: html
* - .. raw:: html
.. _ansible_collections.netbox.netbox.netbox_ip_address_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 IP address module" connection: local hosts: localhost gather_facts: false tasks: - name: Create IP address within NetBox with only required information netbox.netbox.netbox_ip_address: netbox_url: http://netbox.local netbox_token: thisIsMyToken data: address: 192.168.1.10 state: present - name: Force to create (even if it already exists) the IP netbox.netbox.netbox_ip_address: netbox_url: http://netbox.local netbox_token: thisIsMyToken data: address: 192.168.1.10 state: new - name: Get a new available IP inside 192.168.1.0/24 netbox.netbox.netbox_ip_address: netbox_url: http://netbox.local netbox_token: thisIsMyToken data: prefix: 192.168.1.0/24 state: new - name: Delete IP address within netbox netbox.netbox.netbox_ip_address: netbox_url: http://netbox.local netbox_token: thisIsMyToken data: address: 192.168.1.10 state: absent - name: Create IP address with several specified options netbox.netbox.netbox_ip_address: netbox_url: http://netbox.local netbox_token: thisIsMyToken data: address: 192.168.1.20 vrf: Test tenant: Test Tenant status: Reserved role: Loopback description: Test description tags: - Schnozzberry state: present - name: Create IP address and assign a nat_inside IP netbox.netbox.netbox_ip_address: netbox_url: http://netbox.local netbox_token: thisIsMyToken data: address: 192.168.1.30 vrf: Test nat_inside: address: 192.168.1.20 vrf: Test interface: name: GigabitEthernet1 device: test100 - name: Ensure that an IP inside 192.168.1.0/24 is attached to GigabitEthernet1 netbox.netbox.netbox_ip_address: netbox_url: http://netbox.local netbox_token: thisIsMyToken data: prefix: 192.168.1.0/24 vrf: Test interface: name: GigabitEthernet1 device: test100 state: present - name: Attach a new available IP of 192.168.1.0/24 to GigabitEthernet1 netbox.netbox.netbox_ip_address: netbox_url: http://netbox.local netbox_token: thisIsMyToken data: prefix: 192.168.1.0/24 vrf: Test interface: name: GigabitEthernet1 device: test100 state: new - name: Attach a new available IP of 192.168.1.0/24 to GigabitEthernet1 (NetBox 2.9+) netbox.netbox.netbox_ip_address: netbox_url: http://netbox.local netbox_token: thisIsMyToken data: prefix: 192.168.1.0/24 vrf: Test assigned_object: name: GigabitEthernet1 device: test100 state: new .. 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_ip_address_module__return-ip_address: .. rst-class:: ansible-option-title **ip_address** .. 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_ip_address_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) - Anthony Ruhier (@Anthony25) .. 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