arista.cvp.cv_device_v3 (3.10.1) — module

Manage Provisioning topology.

| "added in version" 3.0.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 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

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# task in loose apply_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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# task in loose apply_mode and loose inventory_mode using fqdn (default)
- name: Device Management in CloudVision
  hosts: cv_server
  connection: local
  gather_facts: false
  collections:
    - arista.cvp
  vars:
    CVP_DEVICES:
      - fqdn: NON-EXISTING-DEVICE
        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
        inventory_mode: loose
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.

# task in loose apply_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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# task in strict apply_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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# 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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# 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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# 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

Inputs

    
state:
    choices:
    - present
    - factory_reset
    - provisioning_reset
    - absent
    default: present
    description: Set if Ansible should build, remove devices from provisioning, fully
      decommission or factory reset devices on CloudVision.
    required: false
    type: str

devices:
    description: List of devices with their container, configlet, and image bundle information.
    elements: dict
    required: true
    type: list

apply_mode:
    choices:
    - loose
    - strict
    default: loose
    description: Set how configlets are attached/detached on device. If set to strict,
      all configlets and image bundles not listed in your vars are detached.
    required: false
    type: str

search_key:
    choices:
    - fqdn
    - hostname
    - serialNumber
    default: hostname
    description: Key name to use to look for device in CloudVision.
    required: false
    type: str

inventory_mode:
    choices:
    - loose
    - strict
    default: strict
    description: Define how missing devices are handled. "loose" will ignore missing devices.
      "strict" will fail on any missing device.
    required: false
    type: str