Skip to content

Content for Ansible meetup workshop dedicated to CI/CD for network management

License

Notifications You must be signed in to change notification settings

tcrichton/arista-ansible-meetup

Repository files navigation

Ansible CI/CD Meetup demo

Overview

Repository provides content to support Ansible meetup run in London in July 2019 to talk about Ansible, Continuous Integration & Deployment

CI/CD approach has been built with a gitlab stack as it is an easy solution to deploy on premise. Gitlab server stack is available to use with docker-compose. If required a more complete repository is available on github

Even if all configuration management use eos_config role from ansible, idea is not to detail how it works in detail. If you want more information, you can find some how-tos (original github) and on ansible documentation

Content description

To support demo, following network topology is used by Ansible

Network Topology

Network description

  • Management network: 10.255.0.0/24
  • Underlay network block: 172.16.0.0/24 (with /31 point to point connection)
  • Customer Vlans: vid 100 / 10.100.0.0/24 - vid 200 / 10.200.0.0/24

Ansible content

Playbooks

Repository comes with a set of playbooks:

As running in inteneded way, new elements are added and non expected configurations are removed.

Device data

Inventory is a static one using ini format listing all devices and credentials to connect:

[spine]
spine01 ansible_host=10.255.0.100
spine02 ansible_host=10.255.0.101

[leaf]
leaf01 ansible_host=10.255.0.102
leaf02 ansible_host=10.255.0.103

[all:vars]
ansible_user='ansible'
ansible_ssh_pass='ansible'

Data for every devices are stored in a JSON file per host under host_vars. In this demo, we are not using high level abastraction to represent topology and we focus on ansible and CI/CD implementation.

Below is a JSON snippet from leaf01:

{
    "hostname": "leaf01",
    "interfaces": {
        "physical": {
            "ethernet 1": {
                "key": "ethernet 1",
                "ip_address": {
                    "v4": {
                        "address": "172.16.0.1",
                        "netmask": 31
                    }
                },
                "description": "to spine01 -- et1",
                "role": "ip_address",
                "mtu": 9200,
                "speed": "auto",
                "state": "enable"
            }
        }
    }
}

Device configuration management

All configuration are managed in some roles and use JINJA2 templates with more or less complexity.

CI/CD workflow

Continuous Integration process is based on [gitlab-ci] as it is a good option to house your own git server with a complete set of features.

Workflow implements a multi-stages approach :

  • checks: Stage to validate ansible code quality
  • build: Create configuration files shared across all other stages
  • staging: Make pre-flight tests. In this demo, it is mainly to collect diff against production and batfish validation. But can also be used to spin-up a lab environment to validate
  • deploy: Apply configuration to network topology.
  • post_deployment: Run post-flight tests to ensure network is running as expecting.

All this stages run at different time in the workflow. Below is result of a merge request into master:

Merge Request CI/CD

Resources

License

Project is published under BSD License.

Ask question or report issue

Please open an issue on Github this is the fastest way to get an answer.

Contribute

Contributing pull requests are gladly welcomed for this repository. If you are planning a big change, please start a discussion first to make sure we’ll be able to merge it.

About

Content for Ansible meetup workshop dedicated to CI/CD for network management

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages