

After the VM is up it applies an Ansible playbook to it to install VirtualBox guest additions.Feeds a kickstart file to it for an unattended installation.Creates a Virtualbox VM from an ISO image.

To save you a lot of typing I collated all my Packer-related posts in a dedicated Github repository: High-level stepsįrom a bird’s eye view, using my code Packer template… However, at the time of writing the documentation warns that HCL2 support is still in beta, which is why I went with the JSON template language. Which is nice, as it allows me to reuse (or rather add to) my Terraform skills. If you are new to Packer, I suggest you visit the website for more information and some really great guides.Īs of Packer 1.5 you can also use HCL2. Packer works by reading a template file and performs the tasks defined therein. Vagrant 2.2.7 will power my VMs after they are created.Įxcept for VirtualBox and Packer I’m using the stock packages supplied by Ubuntu. Ansible 2.9 helps me configure my systems. Packer 1.5 does all the hard work provisioning VMs for Virtualbox 6.1.12. I’m using Ubuntu 20.04.1 LTS as my host operating system. Instead of the insecure key pair I’m using my own keys as well.

Since I’m building private Vagrant boxes I don’t intend to share I can ignore the requirements about passwords as documented in the Vagrant documentation, section “Default User Settings”.

All my processes and workflows therefore need to be defined in software (Infrastructure as Code). I would like to build a new Vagrant base box for Oracle Linux 7.8, completely hands-off. More importantly though, I can simply kick the process off, grab a coffee, and when I’m back, enjoy a new build of my Oracle Linux Vagrant base box. Combined with local box versioning I can build new Vagrant systems in almost no time. Since I work with VirtualBox and Vagrant a lot, Packer’s ability to create Vagrant base boxes is super awesome. In addition to the cloud, Packer supports a great many other build targets as well. I have referred to Packer in some of my cloud-related presentations as an example of a tool for creating immutable infrastructure.
