arista.cvp.cv_tag_v3 (3.10.1) — module

Create/Assign/Delete/Unassign tags on CVP

| "added in version" 3.4.0 of arista.cvp"

Authors: Ansible Arista Team (@aristanetworks)

Install collection

Install with ansible-galaxy collection install arista.cvp:==3.10.1


Add to requirements.yml

  collections:
    - name: arista.cvp
      version: 3.10.1

Description

CloudVision Portal Tag module to Create/Assign/Delete/Unassign tags on CloudVision

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Create and assign device and interface tags to multiple devices and interfaces
- name: cv_tag_v3 example1
  hosts: cv_server
  connection: local
  gather_facts: no
  vars:
    CVP_TAGS:
      - device: leaf1
        device_tags:
          - name: tag1
            value: value1
          - name: tag2
            value: value2
          - name: tag3
            value: value3
        interface_tags:
          - interface: Ethernet1
            tags:
              - name: tag1i
                value: value1i
              - name: tag2i
                value: value2i
          - interface: Ethernet2
            tags:
              - name: tag1i
                value: value1i
              - name: tag2i
                value: value2i
      - device: spine1
        device_tags:
          - name: DC
            value: Dublin
          - name: rack
            value: rackA
          - name: pod
            value: podA
        interface_tags:
          - interface: Ethernet3
            tags:
              - name: tag3i
                value: value3i
              - name: tag4i
                value: value4i
          - interface: Ethernet4
            tags:
              - name: tag5i
                value: value6i
              - name: tag6i
                value: value6i
  tasks:
    - name: "create tags"
      arista.cvp.cv_tag_v3:
        tags: "{{CVP_TAGS}}"
        mode: assign
        auto_create: true
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Delete device and interface tags using device_id
- name: cv_tag_v3 example2
  hosts: cv_server
  connection: local
  gather_facts: no
  vars:
    CVP_TAGS:
      - device_id: JPE123435
        device_tags:
          - name: tag1
            value: value1
        interface_tags:
          - interface: Ethernet1
            tags:
              - name: tag1i
                value: value1i
  tasks:
    - name: "create tags"
      arista.cvp.cv_tag_v3:
        tags: "{{CVP_TAGS}}"
        mode: delete
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Create device and interface tags (without assigning to the devices) using device_id
- name: cv_tag_v3 example3
  hosts: cv_server
  connection: local
  gather_facts: no
  vars:
    CVP_TAGS:
      - device_id: JPE123435
        device_tags:
          - name: tag1
            value: value1
        interface_tags:
          - interface: Ethernet1
            tags:
              - name: tag1i
                value: value1i
  tasks:
    - name: "create tags"
      arista.cvp.cv_tag_v3:
        tags: "{{CVP_TAGS}}"
        mode: create
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Assign device and interface tags
- name: cv_tag_v3 example4
  hosts: cv_server
  connection: local
  gather_facts: no
  vars:
    CVP_TAGS:
      - device: leaf1
        device_tags:
          - name: tag1
            value: value1
        interface_tags:
          - interface: Ethernet1
            tags:
              - name: tag1i
                value: value1i
  tasks:
    - name: "create tags"
      arista.cvp.cv_tag_v3:
        tags: "{{CVP_TAGS}}"
        mode: assign
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Unassign device and interface tags
- name: cv_tag_v3 example5
  hosts: cv_server
  connection: local
  gather_facts: no
  vars:
    CVP_TAGS:
      - device: leaf1
        device_tags:
          - name: tag1
            value: value1
        interface_tags:
          - interface: Ethernet1
            tags:
              - name: tag1i
                value: value1i
  tasks:
    - name: "create tags"
      arista.cvp.cv_tag_v3:
        tags: "{{CVP_TAGS}}"
        mode: assign

Inputs

    
mode:
    choices:
    - create
    - delete
    - assign
    - unassign
    description: Action to carry out on the tags.
    required: false
    type: str

tags:
    description: List of CVP tags.
    elements: dict
    required: true
    type: list

auto_create:
    default: true
    description: Automatically create tags before assigning.
    required: false
    type: bool