networktocode.nautobot.ip_address module – Creates or removes IP addresses from Nautobot
Note
This module is part of the networktocode.nautobot collection (version 5.1.1).
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 |
|
Must exist in Nautobot and in key/value format |
|
The description of the interface |
|
Hostname or FQDN |
|
namespace that IP address is associated with. IPs are unique per namespaces. Default: :ansible-option-default:`"Global"` |
|
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: |
|
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 type of the IP address 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` |
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: Create the same IP under another namespace
networktocode.nautobot.ip_address:
url: http://nautobot.local
token: thisIsMyToken
address: 192.168.1.10
namespace: MyNewNamespace
state: new
- name: Get a new available IP inside 192.168.1.0/24
networktocode.nautobot.ip_address:
url: http://nautobot.local
token: thisIsMyToken
parent: 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 in namespace Private
networktocode.nautobot.ip_address:
url: http://nautobot.local
token: thisIsMyToken
address: 192.168.1.20
tenant: Test Tenant
status: Reserved
namespace: Private
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
nat_inside:
address: 192.168.1.20
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 |