The opinions on this site are my own, and are not necessarily shared by my employer.
Imagr with target disk mode
11 Jan 2017
Imagr is a great tool when you’re wanting to deploy machines quickly in your office. But sometimes you will want to deploy machines when you’re in a smaller remote site, or a site where security concerns mean you can’t have servers. Imagr is flexible enough to handle this, and with a little creativity, we can deploy at these sites as easily as we can at our offices with NetBoot.
The first thing you are going to want to do it get your Imagr repo onto your own machine. I would recommend having your repo in a central repository - git fat works well, so does putting everything on an S3 bucket and using the aws cli tools to sync it down. We use an S3 bucket, as we can ship read only credentials to the machines that are performing the imaging. This guide will assume you are using S3, but you can substitute that aspect for whichever method you wish to sync your files.
You will also need to place Imagr.app on the machine somewhere, and point it to your configuration file. The configuration file can be on a web server (as it’s tiny, it will only take a second to download), or it can be on your local disk.
The wrapper script
Imagr was originally designed to be run from a NetInstall / NetBoot environment - this means that it is running as root. To ensure that the people performing the imaging don’t open it as a user without the right permissions, we use a wrapper script. This script is also a great place for you to put the code that syncs the code down to the local machine, to ensure your techs are using the latest version of your repo. The following script assumes that:
The aws cli tools are installed (sudo easy_install awscli)
You have Imagr.app in /Applications
You will be storing the Imagr repo at /usr/local/imagr
The below script will:
Download sync your local copy of the Imagr repo with what is in S3
Make sure there is a writable disk available, with Preserve Ownership enabled
Open Imagr.app as root
Now Imagr is opening up, it’s time to make get our workflows ready. I’ve tried to keep things as simple as possible for our techs, so we use scripted included workflows. The basic idea is that we test if the local repo is present, and use that if it is. If not, we fall back to the repo that is on our web server. (Note: this isn’t a full configuration, it is merely an example of the scenario described above)
Things to note
When you see references to Reboot or Shutdown, this is referring to the machine Imagr is running on, not the volume you are imaging. Similarly, there is no way to know anything about the machine you are imaging (as it is just an external disk), so all variable substitution will be for the machine that Imagr is running on, not the disk you are restoring.