networktocode.nautobot.tag (5.1.1) — module

Creates or removes tags from Nautobot

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

Authors: Pavel Korovin (@pkorovin)

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 tags from Nautobot


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: "Test tags creation/deletion"
  connection: local
  hosts: localhost
  gather_facts: False
  tasks:
    - name: Create tags
      networktocode.nautobot.tag:
        url: http://nautobot.local
        token: thisIsMyToken
        api_version: "1.3"
        name: "{{ item.name }}"
        description: "{{ item.description }}"
        content_types:
          - circuits.circuit
          - circuits.circuit termination
          - circuits.provider
          - circuits.provider network
          - dcim.cable
          - dcim.console port
          - dcim.console server port
          - dcim.device
          - dcim.device bay
          - dcim.device type
          - dcim.front port
          - dcim.interface
          - dcim.inventory item
          - dcim.power feed
          - dcim.power outlet
          - dcim.power panel
          - dcim.power port
          - dcim.rack
          - dcim.rack reservation
          - dcim.rear port
          - dcim.virtual chassis
          - extras.Git repository
          - extras.job
          - extras.secret
          - ipam.aggregate
          - ipam.IP address
          - ipam.prefix
          - ipam.route target
          - ipam.service
          - ipam.VLAN
          - ipam.VRF
          - tenancy.tenant
          - virtualization.cluster
          - virtualization.virtual machine
          - virtualization.VM interface
      loop:
        - { name: mgmt, description: "management" }
        - { name: tun, description: "tunnel" }
      

    - name: Delete tags
      networktocode.nautobot.tag:
        url: http://nautobot.local
        token: thisIsMyToken
        name: "{{ item }}"
        state: absent
      loop:
        - mgmt
        - tun

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

name:
    description:
    - Tag name
    required: true
    type: str
    version_added: 3.0.0
    version_added_collection: networktocode.nautobot

color:
    description:
    - Tag color
    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

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

description:
    description:
    - Tag description
    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

content_types:
    description:
    - Tags content type(s). These match app.endpoint and the endpoint is singular.
    - e.g. dcim.device, ipam.ipaddress (more can be found in the examples)
    - Required if I(state=present) and the tag does not exist yet
    elements: str
    required: false
    type: list

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

msg:
  description: Message indicating failure or info about what has been achieved
  returned: always
  type: str
tags:
  description: Serialized object as created/existent/updated/deleted within Nautobot
  returned: always
  type: dict