Skip to content

cv_device_v3

cv_device_v3

Manage Provisioning topology.

Module added in version 3.0.0

Synopsis

CloudVision Portal Configlet configuration requires a dictionary of containers with their parent, to create and delete containers on CVP side. Returns number of created and/or deleted containers

Module-specific Options

The following options may be specified for this module:

parameter type required default choices comments
apply_mode
str no loose
  • loose
  • strict
Set how configlets are attached/detached on device. If set to strict, all configlets and image bundles not listed in your vars are detached.
devices
list yes
List of devices with their container, configlet, and image bundle information
search_key
str no hostname
  • fqdn
  • hostname
  • serialNumber
Key name to use to look for device in CloudVision.
state
str no present
  • present
  • factory_reset
  • provisioning_reset
  • absent
Set if Ansible should build, remove devices from provisioning, fully decommission or factory reset devices on CloudVision


Examples:

# task in loose mode using fqdn (default)
- name: Device Management in CloudVision
  hosts: cv_server
  connection: local
  gather_facts: false
  collections:
    - arista.cvp
  vars:
    CVP_DEVICES:
      - fqdn: CV-ANSIBLE-EOS01
        parentContainerName: ANSIBLE
        configlets:
            - 'CV-EOS-ANSIBLE01'
        imageBundle: leaf_image_bundle
  tasks:
    - name: "Configure devices on {{inventory_hostname}}"
      arista.cvp.cv_device_v3:
        devices: '{{CVP_DEVICES}}'
        state: present
        search_key: fqdn

# task in loose mode using serial
- name: Device Management in CloudVision
  hosts: cv_server
  connection: local
  gather_facts: false
  collections:
    - arista.cvp
  vars:
    CVP_DEVICES:
      - serialNumber: xxxxxxxxxxxx
        parentContainerName: ANSIBLE
        configlets:
            - 'CV-EOS-ANSIBLE01'
  tasks:
    - name: "Configure devices on {{inventory_hostname}}"
      arista.cvp.cv_device_v3:
        devices: '{{CVP_DEVICES}}'
        state: present
        search_key: serialNumber

# task in strict mode
- name: Device Management in CloudVision
  hosts: cv_server
  connection: local
  gather_facts: false
  collections:
    - arista.cvp
  vars:
    CVP_DEVICES:
      - fqdn: CV-ANSIBLE-EOS01
        parentContainerName: ANSIBLE
        configlets:
            - 'CV-EOS-ANSIBLE01'
  tasks:
    - name: "Configure devices on {{inventory_hostname}}"
      arista.cvp.cv_device_v3:
        devices: '{{CVP_DEVICES}}'
        state: present
        apply_mode: strict

# Decommission devices (remove from both provisioning and telemetry)
- name: Decommission device
  hosts: cv_server
  connection: local
  gather_facts: no
  vars:
    CVP_DEVICES:
      - fqdn: leaf1
        parentContainerName: ""
  tasks:
  - name: decommission device
    arista.cvp.cv_device_v3:
        devices: '{{CVP_DEVICES}}'
        state: absent

# Remove a device from provisioning
# Post 2021.3.0 the device will be automatically re-registered and moved to the Undefined container
- name: Remove device
  hosts: CVP
  connection: local
  gather_facts: no
  vars:
    CVP_DEVICES:
      - fqdn: leaf2
        parentContainerName: ""
  tasks:
  - name: remove device
    arista.cvp.cv_device_v3:
        devices: '{{CVP_DEVICES}}'
        state: provisioning_reset

# Factory reset a device (moves the device to ZTP mode)
- name: Factory reset device
  hosts: CVP
  connection: local
  gather_facts: no
  vars:
    CVP_DEVICES:
      - fqdn: leaf2
        parentContainerName: ""
  tasks:
  - name: remove device
    arista.cvp.cv_device_v3:
        devices: '{{CVP_DEVICES}}'
        state: factory_reset
Author
  • Ansible Arista Team (@aristanetworks)
Full Schema

Get full schema docs here.


Last update: November 1, 2022