networktocode.nautobot.ip_address (5.1.1) — module

Creates or removes IP addresses from Nautobot

| "added in version" 1.0.0 of networktocode.nautobot"

Authors: Mikhail Yohman (@FragmentedPacket), Anthony Ruhier (@Anthony25)

Install collection

Install with ansible-galaxy collection install networktocode.nautobot:==5.1.1


Add to requirements.yml

  collections:
    - name: networktocode.nautobot
      version: 5.1.1

Description

Creates or removes IP addresses from Nautobot


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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

Inputs

    
url:
    description:
    - 'The URL of the Nautobot instance resolvable by the Ansible host (for example: http://nautobot.example.com:8000)'
    required: true
    type: str

role:
    description:
    - The role of the IP address
    required: false
    type: raw
    version_added: 3.0.0
    version_added_collection: networktocode.nautobot

tags:
    description:
    - Any tags that this item may need to be associated with
    elements: raw
    required: false
    type: list
    version_added: 3.0.0
    version_added_collection: networktocode.nautobot

type:
    choices:
    - DHCP
    - Host
    - SLAAC
    description:
    - The type of the IP address
    required: false
    type: str
    version_added: 5.0.0
    version_added_collection: networktocode.nautobot

state:
    choices:
    - absent
    - new
    - present
    default: present
    description:
    - 'Use C(present), C(new) or C(absent) for adding, force adding or removing.

      C(present) will check if the IP is already created, and return it if

      true. C(new) will force to create it anyway (useful for anycasts, for

      example).

      '
    type: str

token:
    description:
    - The token created within Nautobot to authorize API access
    required: true
    type: str

parent:
    description:
    - 'With state C(new), it will force to get the next available IP in

      this prefix.

      Required if state is C(present) or C(new) when no address is given.

      Unused if an address is specified.

      '
    required: false
    type: raw
    version_added: 3.0.0
    version_added_collection: networktocode.nautobot

status:
    description:
    - The status of the IP address
    - Required if I(state=present) and does not exist yet
    required: false
    type: raw
    version_added: 3.0.0
    version_added_collection: networktocode.nautobot

tenant:
    description:
    - The tenant that the device will be assigned to
    required: false
    type: raw
    version_added: 3.0.0
    version_added_collection: networktocode.nautobot

address:
    description:
    - Required if state is C(present)
    required: false
    type: str
    version_added: 3.0.0
    version_added_collection: networktocode.nautobot

dns_name:
    description:
    - Hostname or FQDN
    required: false
    type: str
    version_added: 3.0.0
    version_added_collection: networktocode.nautobot

namespace:
    default: Global
    description:
    - 'namespace that IP address is associated with. IPs are unique per namespaces.

      '
    required: false
    type: str
    version_added: 5.0.0
    version_added_collection: networktocode.nautobot

nat_inside:
    description:
    - The inside IP address this IP is assigned to
    required: false
    type: raw
    version_added: 3.0.0
    version_added_collection: networktocode.nautobot

api_version:
    description:
    - API Version Nautobot REST API
    required: false
    type: str
    version_added: 4.1.0
    version_added_collection: networktocode.nautobot

description:
    description:
    - The description of the interface
    required: false
    type: str
    version_added: 3.0.0
    version_added_collection: networktocode.nautobot

query_params:
    description:
    - 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.
    elements: str
    required: false
    type: list
    version_added: 3.0.0
    version_added_collection: networktocode.nautobot

custom_fields:
    description:
    - Must exist in Nautobot and in key/value format
    required: false
    type: dict
    version_added: 3.0.0
    version_added_collection: networktocode.nautobot

validate_certs:
    default: true
    description:
    - If C(no), SSL certificates will not be validated. This should only be used on personally
      controlled sites using self-signed certificates.
    required: false
    type: raw

Outputs

ip_address:
  description: Serialized object as created or already existent within Nautobot
  returned: on creation
  type: dict
msg:
  description: Message indicating failure or info about what has been achieved
  returned: always
  type: str