networktocode.nautobot.cable (5.1.1) — module

Create, update or delete cables within Nautobot

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

Authors: Tobias Groß (@toerb)

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, updates or removes cables from Nautobot


Requirements

Usage examples

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

  tasks:
    - name: Create cable within Nautobot with only required information
      networktocode.nautobot.cable:
        url: http://nautobot.local
        token: thisIsMyToken
        termination_a_type: dcim.interface
        termination_a:
          device: Test Nexus Child One
          name: Ethernet2/2
        termination_b_type: dcim.interface
        termination_b:
          device: Test Nexus Child One
          name: Ethernet2/1
        status: active
        state: present

    - name: Update cable with other fields
      networktocode.nautobot.cable:
        url: http://nautobot.local
        token: thisIsMyToken
        termination_a_type: dcim.interface
        termination_a:
          device: Test Nexus Child One
          name: Ethernet2/2
        termination_b_type: dcim.interface
        termination_b:
          device: Test Nexus Child One
          name: Ethernet2/1
        type: mmf-om4
        status: planned
        label: label123
        color: abcdef
        length: 30
        length_unit: m
        state: present

    - name: Delete cable within nautobot
      networktocode.nautobot.cable:
        url: http://nautobot.local
        token: thisIsMyToken
        termination_a_type: dcim.interface
        termination_a:
          device: Test Nexus Child One
          name: Ethernet2/2
        termination_b_type: dcim.interface
        termination_b:
          device: Test Nexus Child One
          name: Ethernet2/1
        state: absent

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

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

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

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

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

length:
    description:
    - The length of the cable
    required: false
    type: int
    version_added: 3.0.0
    version_added_collection: networktocode.nautobot

status:
    description:
    - The status of the cable
    - Required if I(state=present) and does not exist yet
    required: false
    type: str
    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

length_unit:
    description:
    - The unit in which the length of the cable is measured
    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

termination_a:
    description:
    - The termination a
    required: true
    type: raw
    version_added: 3.0.0
    version_added_collection: networktocode.nautobot

termination_b:
    description:
    - The termination b
    required: true
    type: raw
    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

termination_a_type:
    choices:
    - circuits.circuittermination
    - dcim.consoleport
    - dcim.consoleserverport
    - dcim.frontport
    - dcim.interface
    - dcim.powerfeed
    - dcim.poweroutlet
    - dcim.powerport
    - dcim.rearport
    description:
    - The type of the termination a
    required: true
    type: str
    version_added: 3.0.0
    version_added_collection: networktocode.nautobot

termination_b_type:
    choices:
    - circuits.circuittermination
    - dcim.consoleport
    - dcim.consoleserverport
    - dcim.frontport
    - dcim.interface
    - dcim.powerfeed
    - dcim.poweroutlet
    - dcim.powerport
    - dcim.rearport
    description:
    - The type of the termination b
    required: true
    type: str
    version_added: 3.0.0
    version_added_collection: networktocode.nautobot

Outputs

cable:
  description: Serialized object as created or already existent within Nautobot
  returned: success (when I(state=present))
  type: dict
msg:
  description: Message indicating failure or info about what has been achieved
  returned: always
  type: str