[RETIRED] Demo: OSPF Unnumbered Using Ansible in the Cumulus Workbench


Important! This article has been retired. Check out our GitHub site for the latest demos.

Using Zero Touch Provisioning and Ansible, a set of nodes can be automatically configured to establish OSPF in Quagga with unnumbered links, and leverage PTM to verify the topology. Ansible collects the active state from the nodes and provides it via the management workstation.



Demonstrated Features

Supported Topologies


2-Spine + 2-Leaf (T2):


Required Packages

  • cldemo-wbench-ospfunnum-ansible

Source Code

File Descriptions

File Description
/var/www/ansible_authorized_keys Public authorization key for root user to manage from workbench host
/var/www/provision-ansible.sh ZTP automation script to install root user authorized key file
/var/www/topology.dot Network topology file for PTM to validate against
List of nodes Ansible will manage
/home/cumulus/example-ospfunnum-ansible/handlers/main.yml The main handlers file for Ansible, that defines how to accomplish the required tasks
/home/cumulus/example-ospfunnum-ansible/roles/ospfunnum/tasks/main.yml The main tasks file for Ansible that sets out what needs to be done on the nodes
The directory that holds the templates that Ansible uses to build various configuration files used by the nodes
The primary file that Ansible uses to apply the overall policy to the site

Getting Started

Preparing the Environment

Ansible can be installed with the OSPF unnumbered configuration from the workbench. To install Ansible:

  1. Log into the Cumulus workbench and accept the End User License Agreement.

  2. As the root user, update the workbench:

    root@wbench:~# apt-get update
  3. Install the Ansible package for OSPF:

    root@wbench:~# apt-get install cldemo-wbench-ospfunnum-ansible
  4. Navigate into the Ansible example directory:

    root@wbench:~# cd /home/cumulus/example-ospfunnum-ansible/
  5. Restart each switch in order for the autoprovisioning script needed for Ansible to manage them to start:

    root@wbench:/home/cumulus/example-ospfunnum-ansible# cwng-swpower -a -o reset
  6. Ping each node with Ansible, and follow the prompts to accept the SSH keys:

    root@wbench:/home/cumulus/example-ospfunnum-ansible# ansible all -i hosts -m ping

To confirm the environment is ready for the demo, you can:

  • Follow along via the console for each switch:

    root@wbench:/home/cumulus/example-ospfunnum-ansible# tail -f /var/log/autoprovision
  • Check the status of the environment:

    root@wbench:/home/cumulus/example-ospfunnum-ansible# grep complete /var/lib/cumulus/autoprovision.conf

Running the Demo

To start Ansible, and provision the nodes:

  1. Run the following command on the workbench:

    root@wbench:/home/cumulus/example-ospfunnum-ansible# ansible-playbook -i hosts site-ospfunnum.yml

    Ansible will now run through the set of actions that it has been configured to perform. These include:

    • Configure two new users,rocket and turtle, and grant them sudo access
    • Set the MOTD of the nodes
    • Perform all of the steps necessary to install the Cumulus Linux license and insure that switchd restarts
    • Set the configuration of all of the interfaces
    • Provide ptmd with a topology.dot
    • Enable quagga with OSPF turned on
    • Restart all of the services that have been provided with new configurations
  2. Once the services have restarted, log into a switch:

    root@wbench:/home/cumulus/example-ospfunnum-ansible# ssh leaf1

The following commands can now be run to verify the PTM and LLDP neighbors, and to observe output:

  • Verify the neighbors:

    root@leaf1:~# ptmctl

    Eight active links should be present; four to each spine.

  • Show the OSPF neighbors for each spine:

    root@leaf1:~# cl-ospf neighbor show
  • Check the state of all switches using Ansible:

    • Display the ptmctl output for each node, to show the active links to each neighbor:

      root@wbench:/home/cumulus/example-ospfunnum-ansible# ansible all -i hosts -m shell -a "ptmctl"
    • Display the OSPF neighbor output for each node, to show the active neighbors to each partner node:

      root@wbench:/home/cumulus/example-ospfunnum-ansible# ansible all -i hosts -m shell -a "cl-ospf neighbor show"
    • Display the route table output for each node, to show all local and remote links on all of the other nodes:

      root@wbench:/home/cumulus/example-ospfunnum-ansible# ansible all -i hosts -m shell -a "ip route show"

Ansible can also run commands on a smaller subset of nodes. The following example command displays the bridge table output for the two leaf nodes, to show the two VLANs that are defined:

root@wbench:/home/cumulus/example-ospfunnum-ansible# ansible leaf -i hosts -m shell -a "brctl show"

Note: Other commands can be run on each switch to output additional information, by replacing the command string in the quotes of the commands listed above.

Repeating the Demo

In order to run the demo more than once, Ansible can clear the overlay filesystem and reboot the devices:

  1. Remove the .license.txt file from each node:

    root@wbench:/home/cumulus/example-ospfunnum-ansible# ansible all -i hosts -m shell -a "rm /mnt/persist/etc/cumulus/.license.txt"
  2. Clear the overlay and reboot the devices:

    root@wbench:/home/cumulus/example-ospfunnum-ansible# ansible all -i hosts -m shell -a "/usr/cumulus/bin/cl-img-clear-overlay -f 1; reboot"
  3. When the switches have rebooted, remove the known_hosts file on the workbench VM, to clear the host SSH keys:

    root@wbench:/home/cumulus/example-ospfunnum-ansible# rm /root/.ssh/known_hosts

The environment is now ready to repeat the demo.

Command Reference Cheat Sheet

Description Topology Command
Refresh the apt cache All
apt-get update
Install the demo files All
apt-get install cldemo-wbench-ospfunnum-ansible
Change into the Ansible demo directory All
cd /home/cumulus/example-ospfunnum-ansible
Reset the nodes All
cwng-swpower -a -o reset
Ping the nodes to get the SSH keys All
ansible all -i hosts -m ping
Launch the primary Ansible deployment All
ansible-playbook -i hosts site-ospfunnum.yml
Log into leaf1 All
ssh leaf1
Check PTM All
Check OSPF neighbors All
cl-ospf neighbor show
Exit to return to the MGMT host All
Check PTM on all of the nodes All
ansible all -i hosts -m shell -a "ptmctl"
Check OSPF neighbors on all of the nodes All
ansible all -i hosts -m shell -a "cl-ospf neighbor show"
Check the routing table of the nodes All
ansible all -i hosts -m shell -a "ip route show"
Check a leaf's VLAN setup 2-Switch NA
ansible leaf -i hosts -m shell -a "brctl show"
Remove the license key All
ansible all -i hosts -m shell -a "rm /mnt/persist/etc/cumulus/.license.txt"
Clear overlay and reboot the nodes All
ansible all -i hosts -m shell -a "/usr/cumulus/bin/cl-img-clear-overlay -f 1; reboot"
Remove your SSH known hosts All
rm /root/.ssh/known_hosts
Have more questions? Submit a request


Powered by Zendesk