networktocode.nautobot.ip_address_to_interface (5.1.1) — module

Creates or removes IP address to interface association from Nautobot

| "added in version" 5.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 address to interface association from Nautobot


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: "Test Nautobot IP address to interface module"
  connection: local
  hosts: localhost
  gather_facts: False

  tasks:
    - name: "Add IP address on GigabitEthernet4 - test100"
      networktocode.nautobot.ip_address_to_interface:
        url: "{{ nautobot_url }}"
        token: "{{ nautobot_token }}"
        ip_address: "{{ ip_address['key'] }}"
        interface:
          name: GigabitEthernet4
          device: test100
      vars:
        ip_address: "{{ lookup('networktocode.nautobot.lookup', 'ip-addresses', api_endpoint=nautobot_url, token=nautobot_token, api_filter='address=10.100.0.1/32') }}"

    - name: "Delete IP address on GigabitEthernet4 - test100"
      networktocode.nautobot.ip_address_to_interface:
        url: "{{ nautobot_url }}"
        token: "{{ nautobot_token }}"
        ip_address: "{{ ip_address['key'] }}"
        interface:
          name: GigabitEthernet4
          device: test100
        state: absent
      vars:
        ip_address: "{{ lookup('networktocode.nautobot.lookup', 'ip-addresses', api_endpoint=nautobot_url, token=nautobot_token, api_filter='address=10.100.0.1/32') }}"

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

state:
    choices:
    - absent
    - present
    default: present
    description:
    - Use C(present) or C(absent) for adding, or removing.
    type: str

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

interface:
    description:
    - Device interface to associate with an IP.
    required: false
    type: raw
    version_added: 5.0.0
    version_added_collection: networktocode.nautobot

ip_address:
    description:
    - IP address to associate with an interface.
    required: true
    type: raw
    version_added: 5.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

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

vm_interface:
    description:
    - VM interface to associate with an IP.
    required: false
    type: raw
    version_added: 5.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_to_interface:
  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