项目作者: mweisel

项目描述 :
A Packer template for creating an Arista vEOS-lab Vagrant box for the libvirt provider.
高级语言: HCL
项目地址: git://github.com/mweisel/veos-lab-vagrant-libvirt.git
创建时间: 2019-11-27T04:42:12Z
项目社区:https://github.com/mweisel/veos-lab-vagrant-libvirt

开源协议:MIT License

下载


Vagrant

Arista vEOS-lab Vagrant box

A Packer template for creating an Arista vEOS-lab Vagrant box for the libvirt provider.

Prerequisites

Steps

0. Verify the prerequisite tools are installed.

  1. $ which git packer libvirtd qemu-img qemu-system-x86_64 vagrant
  2. $ vagrant plugin list
  3. 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.

  1. $ qemu-img convert -pO qcow2 $HOME/Downloads/vEOS64-lab-4.28.1F.vmdk $HOME/Downloads/vEOS.qcow2
  2. $ qemu-img check $HOME/Downloads/vEOS.qcow2

3. Copy the converted disk image file to the /var/lib/libvirt/images directory.

  1. $ 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

  1. $ sudo chown libvirt-qemu:kvm /var/lib/libvirt/images/vEOS.qcow2
  2. $ sudo chmod u+x /var/lib/libvirt/images/vEOS.qcow2

Arch Linux

  1. $ sudo chown libvirt-qemu:libvirt-qemu /var/lib/libvirt/images/vEOS.qcow2
  2. $ sudo chmod u+x /var/lib/libvirt/images/vEOS.qcow2

5. Create the boxes directory.

  1. $ mkdir -p $HOME/boxes

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

  1. $ git clone https://github.com/mweisel/veos-lab-vagrant-libvirt
  2. $ cd veos-lab-vagrant-libvirt

7. Packer build to create the Vagrant box artifact. Supply the EOS version number for the version variable value.

  1. $ packer build -var 'version=4.28.1F' arista-veos.pkr.hcl

8. Copy the Vagrant box artifact to the boxes directory.

  1. $ cp ./builds/arista-veos-4.28.1F.box $HOME/boxes/

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

  1. $ cp ./src/arista-veos.json $HOME/boxes/

10. Change the current working directory to boxes.

  1. $ cd $HOME/boxes

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

  1. $ awk '/url/{gsub(/^ */,"");print}' arista-veos.json
  2. "url": "file://HOME/boxes/arista-veos-VER.box"
  3.  
  4. $ sed -i "s|HOME|${HOME}|" arista-veos.json
  5.  
  6. $ awk '/url/{gsub(/^ */,"");print}' arista-veos.json
  7. "url": "file:///home/marc/boxes/arista-veos-VER.box"

12. Also, substitute the VER placeholder string with the EOS version you’re using.

  1. $ awk '/VER/{gsub(/^ */,"");print}' arista-veos.json
  2. "version": "VER",
  3. "url": "file:///home/marc/boxes/arista-veos-VER.box"
  4.  
  5. $ sed -i 's/VER/4.28.1F/g' arista-veos.json
  6.  
  7. $ awk '/\|url/{gsub(/^ */,"");print}' arista-veos.json
  8. "version": "4.28.1F",
  9. "url": "file:///home/marc/boxes/arista-veos-4.28.1F.box"

13. Add the Vagrant box to the local inventory.

  1. $ vagrant box add --box-version 4.28.1F arista-veos.json

License

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