aristanetworks / ansible-cvp

Ansible modules for Arista CloudVision
http://cvp.avd.sh
Apache License 2.0
66 stars 61 forks source link
ansible ansible-collection ansible-modules arista arista-cloudvision cv-device cvprac devops networking

Ansible Modules for Arista CloudVision Platform

Arista CVP [collection version](https://github.com/aristanetworks/ansible-cvp/tags) License Collection code testing

About

Arista Networks supports Ansible for managing devices running the EOS operating system through CloudVision platform (CVP). This roles includes a set of ansible modules that perform specific configuration tasks on CVP server. These tasks include: collecting facts, managing configlets, containers, build provisionning topology and running tasks. For installation, you can refer to specific section of this readme.

Arista CloudVision and Ansible

More documentation is available in project's website

List of CVP versions supported

arista.cvp collection supports list of CloudVision version as listed below:

Starting version 2.0.0, collection uses cvprac as CloudVision connection manager. So support for any new CLoudvision server is tied to it support in this python library.

Collection overview

This repository provides content for Ansible's collection arista.cvp with following content:

List of available modules

Version 3:

List of available roles

Deprecated modules

Example

This example outlines how to use arista.cvp to create a containers topology on Arista CloudVision.

A dedicated repository is available for step by step examples on ansible-cvp-toi.

A complete end to end demo using Arista Validated Design collection and CloudVision modules is available as an example.

Another demonstration repository is available to play with Arista Test Drive. Please reach out to your favorite SE for getting access to such instance.

Below is a very basic example to build a container topology on a CloudVision platform assuming you have 3 veos named veos0{1,3} and a configlet named alias

---
- name: Playbook to demonstrate cvp modules.
  hosts: cv_server
  connection: local
  gather_facts: no
  collections:
    - arista.cvp
  vars:
    # Configlet definition
    device_configuration:
      mlag-01a-config: "{{lookup('file', './config-router-mlag01a.conf')}}"
      mlag-01b-config: "{{lookup('file', './config-router-mlag01b.conf')}}"

    # Container definition
    containers_provision:
        Fabric:
          parentContainerName: Tenant
        Spines:
          parentContainerName: Fabric
        Leaves:
          parentContainerName: Fabric
          configlets:
              - alias
        MLAG01:
          parentContainerName: Leaves

    # Device definition
    devices_provision:
      - fqdn: mlag-01a
        parentContainerName: 'MLAG01'
        configlets:
            - 'mlag-01a-config'
        systemMacAddress: '50:8d:00:e3:78:aa'
      - fqdn: mlag-01b
        parentContainerName: 'MLAG01'
        configlets:
            - 'mlag-01b-config'
        systemMacAddress: '50:8d:00:e3:78:bb'

  tasks:
    - name: "Build Container topology on {{inventory_hostname}}"
      arista.cvp.cv_container_v3:
        topology: '{{containers_provision}}'

    - name: "Configure devices on {{inventory_hostname}}"
      arista.cvp.cv_device_v3:
        devices: '{{devices_provision}}'

As modules of this collection are based on HTTPAPI connection plugin, authentication elements shall be declared using this plugin mechanism and are automatically shared with arista.cvp.cv_* modules.

[development]
cv_server  ansible_host= 10.90.224.122 ansible_httpapi_host=10.90.224.122

[development:vars]
ansible_connection=httpapi
ansible_httpapi_use_ssl=True
ansible_httpapi_validate_certs=False
ansible_user=cvpadmin
ansible_password=ansible
ansible_network_os=eos
ansible_httpapi_port=443

As modules of this collection are based on HTTPAPI connection plugin, authentication elements shall be declared using this plugin mechanism and are automatically shared with arista.cvp.cv_* modules.

Installation

Complete installation process is available on repository website

Requirements

To install requirements please follow this guide.

Installation from ansible-galaxy

Ansible galaxy hosts all stable version of this collection. Installation from ansible-galaxy is the most convenient approach for consuming arista.cvp content

$ ansible-galaxy collection install arista.cvp
Process install dependency map
Starting collection install process
Installing 'arista.cvp:1.0.1' to '~/.ansible/collections/ansible_collections/arista/cvp'

Git installation as source of collection

You can git clone this repository and use examples folder for testing. This folder contains a set of pre-configured playbook and ansible configuration:

git clone https://github.com/aristanetworks/ansible-cvp.git

Update your ansible.cfg to update collections_paths to point to local repository

collections_paths = /path/to/local/repository:~/.ansible/collections:/usr/share/ansible/collections

It is highly recommended to use a python virtual-environment to not alter your production environment.

Docker for testing

In an effort to support both arista.avd and arista.cvp collections, you can find a generic docker image in this repository.

Besides this image, a repository with some basic labs to use as part of a TOI are available in this repository

Resources

Ask a question

Support for this arista.cvp collection is provided by the community directly in this repository. Easiest way to get support is to open an issue.

Branching Model

License

Project is published under Apache 2.0 License