Skip to content

Latest commit

 

History

History
62 lines (38 loc) · 2.92 KB

File metadata and controls

62 lines (38 loc) · 2.92 KB

IOS XE Sandbox Sample Ansible Playbooks

So you are interested in leveraging Ansible for configuration management of your IOS XE devices and are kicking the tires using the IOS XE Programmability Sandbox. Well, you are in the right place!

Here you will find some sample playbooks to deploy common configurations and topologies that are all ready to run against the Sandbox. Just clone down the repository and jump right in.

Quick Links

Code and Ansible Setup

Before you can run your first playbook, you need to:

  1. Reserve and connect to a Sandbox
  2. Download/clone the sample code repository
  3. Setup your workstation for Ansible.

Get the Sample Code

The simplest way to get the code is to just git clone it to your local machine.

# from the directory where you want to put the code 
git clone https://github.com/DevNetSandbox/sbx_iosxe
cd sbx_iosxe

If you'd like to get your very own copy of the repository that you can update or add code to, you may want to "Fork" the repo and clone down your own copy. And please submit Pull Requests for anything cool you build in the Sandbox!

Download with out git

If you'd rather just download the code without mucking around with git, you can do that too. Just hit this link to download a zip file with the code: DevNetSandbox/sbx_iosxe/archive/master.zip

Setup Ansible

Ansible is written in Python which means you set it up using the same steps as any Python application. Like other Python projects, we highly recommend leveraging Virtual Environments with Ansible for the best experience. Also, Ansible is currently only fully supported with Python 2.7, Python 3 support is in "preview".

Follow these steps to create a virtual environment and install the requirements.

# Here we explicitly create the venv with Python 2.7
virtualenv venv --python=python2.7
source venv/bin/activate 
pip install -r requirements.txt

Now Ansible is installed and ready to go. One last step before running any of the sample playbooks is to tell Ansible about the target hosts in the sandbox, and the credentials to use to access.

For the hosts part, included in the directory is ansible.cfg (see it here). This is a standard Ansible file that identifies the default location of the inventory. By including the file within the directory, Ansible will use the hosts file located within the repo.

For the credentials, simply run this command to set a series of local environment variables for Ansible to use. See the file here: .ansible_env

source .ansible_env

Sample Topologies and Configs

Here is a list of the different topologies and configuration details.