Emerald Reverie

Gwmngilfen's blog - Tech, cooking, walking and other randomness from the heart of Scotland

Automated Archlinux Installs With Foreman - Part 2

Welcome back! In Part 1, we got our server set up to build Archlinux machines. Now we need to configure Foreman to make use of it! Let’s get started…

UI configuration

Operating System setup

Firstly we need the Operation System. If you already have some Archlinux clients, this might already be done, but head over to the Operating System page:

and either edit the existing Archlinux OS, or create a new one if need be:

Then edit the page and edit the details to match this:

Don’t worry about partition tables, mirrors, or templates yet - we haven’t created them! Obviously, you may have a different list of architectures - tick what’s right for you.

Save the OS, and move on to Installation Media (just above Operating Systems, under More). Add a New medium (mine is “Archlinux mirror”), give it the URL “http://ftp.archlinux.org/core/os/$arch”, and associate it with your OS type:
Actually, the value for “Path” is just a note for ourselves - due to the fact that Foreman will interpret the $variables and Arch wants the mirror with the literal ‘$’ symbols as above, we can’t actually use this path - we’ll be putting the real mirror directly into the installation template. Save that, and we’ll move on to templates.


We’re going to need a total of 5 files to finish setting up our Arch installer - a PXElinux file, an install script, an AIF profile, a partition table, and a finish script . Be *very* careful with backslashes - AIF uses a lot of shell variables, and we need to be sure that Foreman doesn’t try to interpret them.

For all five of these files, you’ll need to go to the Association tab and tick “Archlinux 1.0”  to associate the template with Archlinux. You can call them what you like, but if you don’t use my suggested names, be sure to update the templates where it’s referenced.

Firstly, we’ll add a partition table to More -> Partition Tables:

As per the Troubleshooting notes, this is all set up for a machine installing to /dev/sda - you can find more examples on the Arch Wiki

Then we’ll go to More -> Provisioning Templates and create the following four files:

Be sure to check through those files for IP addresses that need to be altered for your environment - there are quite a few. In the PXELinux template, change the ONTIMEOUT parameter to arch_http if you’re using the HTTP boot method from page 1.

Now go back to the Operating System page, and edit “Archlinux 1.0”. Ensure the correct Partition Table and Installation Mirror is ticked on the first page. Now go to the Templates tab, and assign the templates to the OS:

Build a Host

We’re finally there! You should now be able to create a new host, assign the correct OS, media, and partition table, and watch it build. Enjoy your tasty Archlinux machines!

Troubleshooting / Notes

I’ve found a number of issues with the present installer ISOs, which have been reported to the Arch Releng team. Most I have been able to work around in the installation templates, but one serious bug remains with GRUB - I cannot make a Virtio-based disk install correctly at all. As such, if you are testing on a virtual machine, I recommend editing that machine and using a SATA based disk which appears as /dev/sda instead of /dev/vda.

Any issues, please do report them in the comments and I’ll update accordingly.