https://github.com/mweisel/cisco-asav-vagrant-libvirt
A procedure for creating a Cisco ASAv Vagrant box for the libvirt provider.
https://github.com/mweisel/cisco-asav-vagrant-libvirt
cisco-asa libvirt-provider vagrant-box
Last synced: 3 months ago
JSON representation
A procedure for creating a Cisco ASAv Vagrant box for the libvirt provider.
- Host: GitHub
- URL: https://github.com/mweisel/cisco-asav-vagrant-libvirt
- Owner: mweisel
- License: mit
- Created: 2020-01-01T22:15:26.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-05-28T21:41:30.000Z (almost 4 years ago)
- Last Synced: 2024-03-22T23:46:50.412Z (about 1 year ago)
- Topics: cisco-asa, libvirt-provider, vagrant-box
- Language: Shell
- Homepage:
- Size: 11.7 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Cisco ASAv Vagrant box
A procedure for creating a Cisco ASAv Vagrant box for the [libvirt](https://libvirt.org) provider.
## Prerequisites
* [Git](https://git-scm.com)
* [Python](https://www.python.org)
* [Ansible](https://docs.ansible.com/ansible/latest/index.html)
* [libvirt](https://libvirt.org) with client tools
* [QEMU](https://www.qemu.org)
* [Vagrant](https://www.vagrantup.com) >= 2.2.10
* [vagrant-libvirt](https://github.com/vagrant-libvirt/vagrant-libvirt)> Vagrant version **2.2.16** introduced a bug that *breaks* SSH connectivity - [#12344](https://github.com/hashicorp/vagrant/issues/12344)
## Steps
0\. Verify the prerequisite tools are installed.
$ which git python ansible libvirtd virsh qemu-system-x86_64 vagrant
$ vagrant plugin list
vagrant-libvirt (0.5.1, global)1\. Install the `genisoimage` tool.
> Ubuntu 18.04
$ sudo apt install genisoimage> Arch Linux
$ sudo pacman -S cdrtools2\. Log in and download the [Cisco Adaptive Security Virtual Appliance qcow2 package for the Cisco ASAv Virtual Firewall](https://software.cisco.com/download/home/286119613/type) file. Save the file to your `Downloads` directory.
3\. Copy (and rename) the disk image file to the `/var/lib/libvirt/images` directory.
$ sudo cp $HOME/Downloads/asav9-16-1.qcow2 /var/lib/libvirt/images/cisco-asav.qcow24\. 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-asav.qcow2
$ sudo chmod u+x /var/lib/libvirt/images/cisco-asav.qcow2> Arch Linux
$ sudo chown nobody:kvm /var/lib/libvirt/images/cisco-asav.qcow2
$ sudo chmod u+x /var/lib/libvirt/images/cisco-asav.qcow25\. Clone this GitHub repo and _cd_ into the directory.
$ git clone https://github.com/mweisel/cisco-asav-vagrant-libvirt
$ cd cisco-asav-vagrant-libvirt6\. Create the `day0.iso` file. The file provides the initial configuration for the Cisco ASAv. It will be mounted and read on first boot.
$ cd files
$ genisoimage -r -o day0.iso day0-config7\. Copy the `day0.iso` file to the `/var/lib/libvirt/images` directory.
$ sudo cp day0.iso /var/lib/libvirt/images/8\. Modify the file ownership and permissions.
> Ubuntu 18.04
$ sudo chown libvirt-qemu:kvm /var/lib/libvirt/images/day0.iso
$ sudo chmod u+x /var/lib/libvirt/images/day0.iso> Arch Linux
$ sudo chown nobody:kvm /var/lib/libvirt/images/day0.iso
$ sudo chmod u+x /var/lib/libvirt/images/day0.iso9\. Create the `boxes` directory.
$ mkdir -p $HOME/boxes10\. Start the `vagrant-libvirt` network (if not already started).
$ virsh -c qemu:///system net-list
$ virsh -c qemu:///system net-start vagrant-libvirt11\. Run the Ansible playbook.
$ cd ..
$ ansible-playbook main.yml12\. Copy (and rename) the Vagrant box artifact to the `boxes` directory.
$ cp cisco-asav.box $HOME/boxes/cisco-asav-9.16.1.box13\. Copy the box metadata file to the `boxes` directory.
$ cp ./files/cisco-asav.json $HOME/boxes/14\. Change the current working directory to `boxes`.
$ cd $HOME/boxes15\. Substitute the `HOME` placeholder string in the box metadata file.
$ awk '/url/{gsub(/^ */,"");print}' cisco-asav.json
"url": "file://HOME/boxes/cisco-asav-VER.box"$ sed -i "s|HOME|${HOME}|" cisco-asav.json
$ awk '/url/{gsub(/^ */,"");print}' cisco-asav.json
"url": "file:///home/marc/boxes/cisco-asav-VER.box"16\. Also, substitute the `VER` placeholder string with the Cisco ASA version you're using.
$ awk '/VER/{gsub(/^ */,"");print}' cisco-asav.json
"version": "VER",
"url": "file:///home/marc/boxes/cisco-asav-VER.box"$ sed -i 's/VER/9.16.1/g' cisco-asav.json
$ awk '/\<version\>|url/{gsub(/^ */,"");print}' cisco-asav.json
"version": "9.16.1",
"url": "file:///home/marc/boxes/cisco-asav-9.16.1.box"17\. Add the Vagrant box to the local inventory.
$ vagrant box add cisco-asav.json## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details