Skip to content

Manage devices

Configure devices on Cloudvision

cv_device_v3 manage devices on CloudVision:

  • Support Configlets attachment
  • Support Container move during provisioning
  • Support device onboarding (from undefined to any container)

Inputs

Full documentation available in module section and a lab is available in the following repository

Input variables
  • Device name.
  • Parent container where to move device.
  • List of configlets to apply to the device.
CVP_DEVICES:
  - fqdn: CV-ANSIBLE-EOS01
    parentContainerName: 'ANSIBLE'
    # Optional fields
    configlets:
        - '01TRAINING-01'
    systemMacAddress: '50:8d:00:e3:78:aa'
    serialNumber: 64793E1D3DE2240F547E5964354214A4
Module inputs
Required Inputs
  • devices: List of devices
Optional inputs
  • state: Define if module should create(default) or delete devices from CV
  • apply_mode: Define how configlets configured to the devices are managed by ansible:
    • loose (default): Configure new configlets to device and ignore configlet already configured but not listed.
    • strict: Configure new configlets to device and remove configlet already configured but not listed.
  • search_key: Define key to use to search for devices.
    • hostname: Use Hostname to get devices.
    • fqdn: Use Hostname + DNS to get devices.
    • serialNumber: Use device serial number to get devices.
# Use default loose apply_mode
- name: "Configure devices on {{inventory_hostname}}"
  arista.cvp.cv_device_v3:
    devices: "{{CVP_DEVICES}}"
  register: CVP_DEVICES_RESULTS

# Use strict apply_mode
- name: "Configure devices on {{inventory_hostname}}"
  arista.cvp.cv_device_v3:
    devices: "{{CVP_DEVICES}}"
    apply_mode: strict
  register: CVP_DEVICES_RESULTS

# Use serial-number to search for devices.
- name: "Configure devices on {{inventory_hostname}}"
  arista.cvp.cv_device_v3:
    devices: "{{CVP_DEVICES}}"
    state: present
    apply_mode: loose
    search_key: serialNumber
  register: CVP_DEVICES_RESULTS

Module output

cv_device returns :

Info

Generated tasks can be consumed directly by cv_tasks_v3.

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'

Last update: September 20, 2021


Back to top