cv_device
cv_device¶
Provision, Reset, or Update CloudVision Portal Devices.
Module added in version 1.0.0
Synopsis¶
CloudVision Portal Device compares the list of Devices in devices against cvp-facts then adds, resets, or updates them as appropriate. If a device is in cvp_facts but not in devices it will be reset to factory defaults in ZTP mode If a device is in devices but not in cvp_facts it will be provisioned If a device is in both devices and cvp_facts its configlets and imageBundles will be compared and updated with the version in devices if the two are different. Warning - reset means devices will be erased and will run full ZTP process. Use this function with caution !
Module-specific Options¶
The following options may be specified for this module:
parameter | type | required | default | choices | comments |
---|---|---|---|---|---|
devices | dict | True | Yaml dictionary to describe intended devices configuration from CVP stand point. | ||
cvp_facts | dict | True | Facts from CVP collected by cv_facts module. | ||
device_filter | list | False | [‘all’] | Filter to apply intended mode on a set of configlet. If not used, then module only uses ADD mode. device_filter list devices that can be modified or deleted based on configlets entries. | |
state | str | False | present |
|
|
configlet_mode | str | False | override |
|
|
options | dict | False | Implements the ability to create a sub-argument_spec, where the sub options of the top level argument are also validated using the attributes discussed in this section. |
Examples¶
---
- name: Test cv_device
hosts: cvp
connection: local
gather_facts: no
collections:
- arista.cvp
vars:
configlet_list:
cv_device_test01: "alias a{{ 999 | random }} show version"
cv_device_test02: "alias a{{ 999 | random }} show version"
# Device inventory for provision activity: bind configlet
devices_inventory:
veos01:
name: veos01
parentContainername: veos01
configlets:
- cv_device_test01
- SYS_TelemetryBuilderV2_172.23.0.2_1
- veos01-basic-configuration
- SYS_TelemetryBuilderV2
tasks:
# Collect CVP Facts as init process
- name: "Gather CVP facts from {{inventory_hostname}}"
cv_facts:
register: cvp_facts
tags:
- always
- name: "Configure devices on {{inventory_hostname}}"
tags:
- provision
cv_device:
devices: "{{devices_inventory}}"
cvp_facts: '{{cvp_facts.ansible_facts}}'
device_filter: ['veos']
register: cvp_device
- name: "Add configlet to device on {{inventory_hostname}}"
tags:
- provision
cv_device:
devices: "{{devices_inventory}}"
cvp_facts: '{{cvp_facts.ansible_facts}}'
configlet_mode: merge
device_filter: ['veos']
register: cvp_device
For a complete list of examples, check them out on our GitHub repository.
Module output¶
Example output
cvp_device:
changed: true
data:
added_tasksIds: []
moved: []
moved_devices: 0
moved_tasksIds: []
provisionned: []
provisionned_devices: 0
tasks:
- ccId: ''
ccIdV2: ''
completedOnInLongFormat: 1697146035906
createdBy: arista
createdOnInLongFormat: 1697146030753
currentTaskName: Submit
currentTaskType: User Task
data:
APP_SESSION_ID: ''
ERROR_IN_CAPTURING_DESIGN_CONFIG: ''
ERROR_IN_CAPTURING_RUNNING_CONFIG: ''
INCORRECT_CONFIG_IN_CAPTURING_DESIGN_CONFIG: ''
INCORRECT_CONFIG_IN_CAPTURING_DESIGN_CONFIG_OUTPUT_INDEX: ''
IS_ADD_OR_MOVE_FLOW: false
IS_AUTO_GENERATED_IN_CVP: false
IS_CONFIG_PUSH_NEEDED: 'yes'
NETELEMENT_ID: 00:1c:73:c0:c6:16
VIEW: CONFIG
WORKFLOW_ACTION: Configlet Push
ZERO_TOUCH_REPLACEMENT: ''
ccExecutingNode: ''
ccId: ''
commandUsedInMgmtIpVal: ''
config: []
configExistInCVP: false
configSnapshots: []
configletList: []
currentparentContainerId: container_4d9e2b7f-c63d-46ee-8fe0-9d7fad83baee
designedConfig: ''
designedConfigOutputIndex: ''
extensionsRequireReboot: []
ignoreConfigletList: []
image: ''
imageBundleId: ''
imageId: []
imageIdList: []
imageToBePushedToDevice: ''
isDCAEnabled: false
isRollbackFromSnapshotFlow: false
isRollbackTask: false
newparentContainerId: container_4d9e2b7f-c63d-46ee-8fe0-9d7fad83baee
noOfRe-Tries: 0
preRollbackImage: ''
presentImageInDevice: ''
runningConfig: ''
sessionUsedInMgmtIpVal: ''
targetIpAddress: ''
user: ''
description: 'Ansible: Configlet Assign: to Device s1-host1.atd.lab'
dualSupervisor: false
executedBy: ''
executedOnInLongFormat: 0
name: ''
netElementId: 00:1c:73:c0:c6:16
newParentContainerId: container_4d9e2b7f-c63d-46ee-8fe0-9d7fad83baee
newParentContainerName: S1-Hosts
note: ''
stageId: ''
taskStatus: ACTIVE
taskStatusBeforeCancel: ''
templateId: ztp
workFlowDetailsId: ''
workOrderDetails:
ipAddress: 192.168.0.244
netElementHostName: s1-host1.atd.lab
netElementId: 00:1c:73:c0:c6:16
serialNumber: s1-host1
workOrderDetailsId: ''
workOrderId: ''
workOrderId: '73'
workOrderState: ACTIVE
workOrderUserDefinedStatus: Pending
tasksIds:
- '73'
updated:
- s1-host1: Configlets-['73']
updated_devices: 1
updated_tasksIds:
- '73'
failed: false
Author¶
Ansible Arista Team (@aristanetworks)