Skip to content

A Packer template for creating a Fortinet FortiGate Vagrant box for the libvirt provider.

License

Notifications You must be signed in to change notification settings

weitzjdevk/fortigate-vagrant-libvirt

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Vagrant

Fortinet FortiGate Vagrant box

A Packer template for creating a Fortinet FortiGate Vagrant box for the libvirt provider.

Prerequisites

Steps

0. Verify the prerequisite tools are installed.

$ which git unzip packer libvirtd qemu-system-x86_64 vagrant
$ vagrant plugin list
vagrant-libvirt (0.9.0, global)

1. Log in and download the FortiGate for KVM platform package from Fortinet. Save the file to your Downloads directory.

2. Extract the disk image file to the /var/lib/libvirt/images directory.

$ cd $HOME/Downloads
$ sudo unzip -d /var/lib/libvirt/images FGT_VM64_KVM-v7.2.0.F-build1157-FORTINET.out.kvm.zip

3. 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/fortios.qcow2
$ sudo chmod u+x /var/lib/libvirt/images/fortios.qcow2

Arch Linux

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

4. Create the boxes directory.

$ mkdir -p $HOME/boxes

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

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

6. Packer build to create the Vagrant box artifact. Supply the FortiOS version number for the version variable value.

$ packer build -var 'version=7.2.0' fortigate.pkr.hcl

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

$ cp ./builds/fortinet-fortigate-7.2.0.box $HOME/boxes/

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

$ cp ./src/fortigate.json $HOME/boxes/

9. Change the current working directory to boxes.

$ cd $HOME/boxes

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

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

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

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

11. Also, substitute the VER placeholder string with the FortiOS version you're using.

$ awk '/VER/{gsub(/^ */,"");print}' fortigate.json
"version": "VER",
"url": "file:///home/marc/boxes/fortinet-fortigate-VER.box"

$ sed -i 's/VER/7.2.0/g' fortigate.json

$ awk '/\<version\>|url/{gsub(/^ */,"");print}' fortigate.json
"version": "7.2.0",
"url": "file:///home/marc/boxes/fortinet-fortigate-7.2.0.box"

12. Add the Vagrant box to the local inventory.

$ vagrant box add --box-version 7.2.0 fortigate.json

License

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

About

A Packer template for creating a Fortinet FortiGate Vagrant box for the libvirt provider.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • HCL 100.0%