So I am late to the Packer party for my organization. I have been watching the products that came out of Hashi Corp and have used some in a past life (Vagrant). In my current role, I had an organization need to create RHEL 7 templates directly from the product iso. This ensures security compliance with minimal historical cruft that our images collect over time due to system updates. I had a need to install the latest packages and tools for team members to manage those systems after they are built. Enter Packer!!! Before, we get started this post will cover some MacBook environment setup.
First, you need to have Homebrew installed. I will make a post about Homebrew when I have some additional time but for now, just check out the site or just run the following command on your MacBook preferred terminal application.
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
$ brew --version Homebrew 2.1.10 Homebrew/homebrew-core (git revision 13869; last commit 2019-08-22) Homebrew/homebrew-cask (git revision cb8b32; last commit 2019-08-22) $ brew update ... citus goofys logtalk qemu wtfutil ckan goreleaser lz4 qpid-proton wxmaxima clamav gradle mailutils rebar3 xxhash clojure grafana mdds rke yank cockroach grpc minio roswell ykman contentful-cli gtk-doc minio-mc rust youtube-dl cpl h2o mkcert s-nail zelda-roth-se cromwell h3 mkvtoolnix saxon zsdx crowdin hapi-fhir-cli mmark email@example.com zstd crystal haproxy mosquitto schismtracker deno hashcat mrboom serverless devspace helmfile mycli skaffold diffoscope helmsman n sonobuoy
After brew is up and running use it to install Packer.
brew install packer
Verify your packer installation completed successfully using the Packer command.
$ packer --version 1.4.2
Instead of the packer provided binary for creating images to be used in our VMware environment, we are using the packer-builder-vsphere, which is provided by Jetbrains. You can find instructions for plugin installation on the Packer docs site. In my instance, I have stored the plugin in the same directory as my Packer code.
- Download the plugin from the release page.
- Rename the plugin removing your version of the os. For example the release download will be packer-builder-vsphere-iso.macos modify it to packer-builder-vsphere-clone
- Add execute rights to the plugin
chmod +x packer-builder-vsphere-clone
Next, you have to install Ansible. The proper way to use python packages is to install them in an isolated virtual space, but that’s a completely different post. Once it’s complete, I will reference it. At this time quickly install it using Homebrew.
$ brew install ansible
Check your installation using ansible.
$ ansible --version ansible 2.5.0
So I have recently just committed to blogging regularly, and I don’t want to have ungodly long articles. Given that I am going to make several additional posts on this subject which will review the good bits now that I have a reference point for all the lame environment set up stuff 🙂