Skip to content

A procedure for creating a Cisco IOSvL2 Vagrant box for the libvirt provider.

License

Notifications You must be signed in to change notification settings

mweisel/cisco-iosvl2-vagrant-libvirt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Vagrant

Cisco IOSvL2 Vagrant box

A procedure for creating a Cisco IOSvL2 Vagrant box for the libvirt provider.

Prerequisites

Steps

0. Verify the prerequisite tools are installed.

$ which git python ansible libvirtd virsh qemu-system-x86_64 expect telnet vagrant
$ vagrant plugin list
vagrant-libvirt (0.5.3, global)

1. Log in and download the CML-P reference platform ISO file to your Downloads directory.

2. Create a mount point directory.

$ sudo mkdir -p /mnt/iso

3. Mount the ISO file.

$ cd $HOME/Downloads
$ sudo mount -o loop refplat-20210511-fcs.iso /mnt/iso

4. Copy (and rename) the Cisco IOSvL2 disk image file to the /var/lib/libvirt/images directory.

$ sudo cp /mnt/iso/virl-base-images/iosvl2-2020/vios_l2-adventerprisek9-m.ssa.high_iron_20200929.qcow2 /var/lib/libvirt/images/cisco-iosvl2.qcow2

5. Unmount the ISO file.

$ sudo umount /mnt/iso

6. Modify the file ownership and permissions. Note the owner may differ between Linux distributions.

Ubuntu 18.04

$ sudo chown libvirt-qemu:kvm /var/lib/libvirt/images/cisco-iosvl2.qcow2
$ sudo chmod u+x /var/lib/libvirt/images/cisco-iosvl2.qcow2

Arch Linux

$ sudo chown nobody:kvm /var/lib/libvirt/images/cisco-iosvl2.qcow2
$ sudo chmod u+x /var/lib/libvirt/images/cisco-iosvl2.qcow2

7. Create the boxes directory.

$ mkdir -p $HOME/boxes

8. Start the vagrant-libvirt network (if not already started).

$ virsh -c qemu:///system net-list
$ virsh -c qemu:///system net-start vagrant-libvirt

9. Clone this GitHub repo and cd into the directory.

$ git clone https://github.com/mweisel/cisco-iosvl2-vagrant-libvirt
$ cd cisco-iosvl2-vagrant-libvirt

10. Run the Ansible playbook.

$ ansible-playbook main.yml

11. Copy (and rename) the Vagrant box artifact to the boxes directory.

$ cp cisco-iosvl2.box $HOME/boxes/cisco-iosvl2-2020.box

12. Copy the box metadata file to the boxes directory.

$ cp ./files/cisco-iosvl2.json $HOME/boxes/

13. Change the current working directory to boxes.

$ cd $HOME/boxes

14. Substitute the HOME placeholder string in the box metadata file.

$ awk '/url/{gsub(/^ */,"");print}' cisco-iosvl2.json
"url": "file://HOME/boxes/cisco-iosvl2-2020.box"

$ sed -i "s|HOME|${HOME}|" cisco-iosvl2.json

$ awk '/url/{gsub(/^ */,"");print}' cisco-iosvl2.json
"url": "file:///home/marc/boxes/cisco-iosvl2-2020.box"

15. Add the Vagrant box to the local inventory.

$ vagrant box add cisco-iosvl2.json

Debug

View the telnet session output for the expect task:

$ tail -f ~/iosvl2-console.explog

License

This project is licensed under the MIT License - see the LICENSE file for details

About

A procedure for creating a Cisco IOSvL2 Vagrant box for the libvirt provider.

Topics

Resources

License

Stars

Watchers

Forks

Languages