networktocode.nautobot.ip_address module – Creates or removes IP addresses from Nautobot¶
Note
This module is part of the networktocode.nautobot collection (version 4.5.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.ip_address
.
New in networktocode.nautobot 1.0.0
Synopsis¶
Creates or removes IP addresses from Nautobot
Requirements¶
The below requirements are needed on the host that executes this module.
pynautobot
Parameters¶
Parameter |
Comments |
---|---|
Required if state is |
|
API Version Nautobot REST API |
|
Definition of the assigned object. |
|
The device the interface is attached to. |
|
The name of the interface |
|
The virtual machine the interface is attached to. |
|
Must exist in Nautobot and in key/value format |
|
The description of the interface |
|
Hostname or FQDN |
|
The inside IP address this IP is assigned to |
|
|
|
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. |
|
The role of the IP address Choices: |
|
Choices: |
|
The status of the IP address Required if state=present and does not exist yet |
|
Any tags that this item may need to be associated with |
|
The tenant that the device will be assigned to |
|
The token created within Nautobot to authorize API access |
|
The URL of the Nautobot instance resolvable by the Ansible host (for example: http://nautobot.example.com:8000) |
|
If Default: :ansible-option-default:`true` |
|
VRF that IP address is associated with |
Notes¶
Note
Tags should be defined as a YAML list
This should be ran with connection
local
and hostslocalhost
Examples¶
- name: "Test Nautobot IP address module"
connection: local
hosts: localhost
gather_facts: False
tasks:
- name: Create IP address within Nautobot with only required information
networktocode.nautobot.ip_address:
url: http://nautobot.local
token: thisIsMyToken
address: 192.168.1.10
status: active
state: present
- name: Force to create (even if it already exists) the IP
networktocode.nautobot.ip_address:
url: http://nautobot.local
token: thisIsMyToken
address: 192.168.1.10
state: new
- name: Get a new available IP inside 192.168.1.0/24
networktocode.nautobot.ip_address:
url: http://nautobot.local
token: thisIsMyToken
prefix: 192.168.1.0/24
state: new
- name: Delete IP address within nautobot
networktocode.nautobot.ip_address:
url: http://nautobot.local
token: thisIsMyToken
address: 192.168.1.10
state: absent
- name: Create IP address with several specified options
networktocode.nautobot.ip_address:
url: http://nautobot.local
token: thisIsMyToken
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
networktocode.nautobot.ip_address:
url: http://nautobot.local
token: thisIsMyToken
address: 192.168.1.30
vrf: Test
nat_inside:
address: 192.168.1.20
vrf: Test
assigned_object:
name: GigabitEthernet1
device: test100
- name: Ensure that an IP inside 192.168.1.0/24 is attached to GigabitEthernet1
networktocode.nautobot.ip_address:
url: http://nautobot.local
token: thisIsMyToken
prefix: 192.168.1.0/24
vrf: Test
assigned_object:
name: GigabitEthernet1
device: test100
state: present
- name: Attach a new available IP of 192.168.1.0/24 to GigabitEthernet1
networktocode.nautobot.ip_address:
url: http://nautobot.local
token: thisIsMyToken
prefix: 192.168.1.0/24
vrf: Test
assigned_object:
name: GigabitEthernet1
device: test100
state: new
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: on creation |
|
Message indicating failure or info about what has been achieved Returned: always |