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 | 
|---|---|---|---|---|---|
| devices | list | True | List of devices with their container, configlet, and image bundle information. | ||
| state | str | False | present | 
 | Set if Ansible should build, remove devices from provisioning, fully decommission or factory reset devices on CloudVision. | 
| apply_mode | str | False | loose | 
 | Set how configlets are attached/detached on device. If set to strict, all configlets and image bundles not listed in your vars are detached. | 
| inventory_mode | str | False | strict | 
 | Define how missing devices are handled. “loose” will ignore missing devices. “strict” will fail on any missing device. | 
| search_key | str | False | hostname | 
 | Key name to use to look for device in CloudVision. | 
Inputs¶
For a full view of the module inputs, please see the schema documentation.
Examples¶
# 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
# 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
# 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
# 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
# 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
For a complete list of examples, check them out on our GitHub repository.
Module output¶
Example output
msg:
  changed: true
  configlets_attached:
    changed: true
    configlets_attached_count: 2
    configlets_attached_list:
    - CV-ANSIBLE-EOS01_configlet_attached - CV-EOS-ANSIBLE01
    diff: {}
    success: true
    taskIds:
    - '469'
  configlets_detached:
    changed: true
    configlets_detached_count: 1
    configlets_detached_list:
    - CV-ANSIBLE-EOS01_configlet_removed - 01DEMO-alias - 01TRAINING-alias
    diff: {}
    success: true
    taskIds:
    - '469'
  devices_deployed:
    changed: false
    devices_deployed_count: 0
    devices_deployed_list: []
    diff: {}
    success: false
    taskIds: []
  devices_moved:
    changed: false
    devices_moved_count: 0
    devices_moved_list: []
    diff: {}
    success: false
    taskIds: []
  failed: false
  success: true
  taskIds:
  - '469'
Author¶
Ansible Arista Team (@aristanetworks)