A Packer template for creating an Arista vEOS-lab Vagrant box for the libvirt provider.
0. Verify the prerequisite tools are installed.
$ which git packer libvirtd qemu-img qemu-system-x86_64 vagrant $ vagrant plugin list vagrant-libvirt (0.9.0, global)
1. Log in and download the vEOS-lab disk image (vmdk) file from Arista. Save the file to your Downloads
directory.
2. Convert the vEOS-lab disk image file from vmdk
to qcow2
.
$ qemu-img convert -pO qcow2 $HOME/Downloads/vEOS64-lab-4.28.1F.vmdk $HOME/Downloads/vEOS.qcow2 $ qemu-img check $HOME/Downloads/vEOS.qcow2
3. Copy the converted disk image file to the /var/lib/libvirt/images
directory.
$ sudo cp $HOME/Downloads/vEOS.qcow2 /var/lib/libvirt/images
4. 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/vEOS.qcow2 $ sudo chmod u+x /var/lib/libvirt/images/vEOS.qcow2
Arch Linux
$ sudo chown libvirt-qemu:libvirt-qemu /var/lib/libvirt/images/vEOS.qcow2 $ sudo chmod u+x /var/lib/libvirt/images/vEOS.qcow2
5. Create the boxes
directory.
$ mkdir -p $HOME/boxes
6. Clone this GitHub repo and cd into the directory.
$ git clone https://github.com/mweisel/veos-lab-vagrant-libvirt $ cd veos-lab-vagrant-libvirt
7. Packer build to create the Vagrant box artifact. Supply the EOS version number for the version
variable value.
$ packer build -var 'version=4.28.1F' arista-veos.pkr.hcl
8. Copy the Vagrant box artifact to the boxes
directory.
$ cp ./builds/arista-veos-4.28.1F.box $HOME/boxes/
9. Copy the box metadata file to the boxes
directory.
$ cp ./src/arista-veos.json $HOME/boxes/
10. Change the current working directory to boxes
.
$ cd $HOME/boxes
11. Substitute the HOME
placeholder string in the box metadata file.
$ awk '/url/{gsub(/^ */,"");print}' arista-veos.json "url": "file://HOME/boxes/arista-veos-VER.box" $ sed -i "s|HOME|${HOME}|" arista-veos.json $ awk '/url/{gsub(/^ */,"");print}' arista-veos.json "url": "file:///home/marc/boxes/arista-veos-VER.box"
12. Also, substitute the VER
placeholder string with the EOS version you're using.
$ awk '/VER/{gsub(/^ */,"");print}' arista-veos.json "version": "VER", "url": "file:///home/marc/boxes/arista-veos-VER.box" $ sed -i 's/VER/4.28.1F/g' arista-veos.json $ awk '/\<version\>|url/{gsub(/^ */,"");print}' arista-veos.json "version": "4.28.1F", "url": "file:///home/marc/boxes/arista-veos-4.28.1F.box"
13. Add the Vagrant box to the local inventory.
$ vagrant box add --box-version 4.28.1F arista-veos.json
This project is licensed under the MIT License - see the LICENSE file for details