Automating Server Provisioning with Foreman — Part 1: Introduction

Mohammad Mahdi Afshari
MCINext
Published in
3 min readJul 14, 2024
A datacenter operator wearing foreman hat working on servers and switches.

Provisioning servers efficiently and consistently is crucial for any organization. Whether you’re managing a small lab or a large data center, automating the process ensures that servers are ready for production workloads. In this guide series, we’ll explore how to set up a robust provisioning solution using Foreman, a powerful open-source lifecycle management tool. In the first part, I will cover some concepts and basics for implementing the solution. This way you would understand next steps better.

What does provisioning mean?

Provisioning refers to the process of setting up IT infrastructure — including hardware, networks, virtual machines, and other resources — and making them available to systems and users. It’s an early step in deployment, distinct from configuration. For the purpose of our guide, we are interested in server provisioning which includes the process of setting up servers leading to OS/hypervisor installation. Manual server provisioning refers to the processes done manually for provisioning — like writing iso images to a suitable USB stick or CD ROM, mounting it to the server, booting the server to the installation media and navigating through installation instructions until the OS/hypervisor is installed. Manual server provisioning can be troublesome and annoying when you have many servers in your organization.

What is Foreman?

Foreman is one of the powerful open-source lifecycle management tools used for managing and automating IT infrastructure. That being said, you can use foreman to provision your servers automatically.

How does Foreman do the magic?

There are multiple subsystems responsible for accomplishing the task. To name some:

  • DHCP Server
  • PXE Environment
  • TFTP Server
  • Kickstart files

We will explore the above subsystems quickly.

DHCP Server

As you’ve guessed, this server implements the well-known DHCP network protocol used to assign IPs to computers in a network. But the DHCP protocol is extendable and isn’t just used to assign IP addresses to a computer; It really can do more than that. If you need to review the protocol, here is the link: Dynamic Host Configuration Protocol — Wikipedia

Foreman uses the well-known isc-dhcp-server package by default for implementing DHCP on a network. There are problems when dealing with this package in a default installation of Foreman that we will cover in the next sections.

PXE Environment

This subsystem is the system which eliminates the need to have a USB stick or a CD ROM as installation media. This is a firmware built into your NIC that makes it possible to transfer files over network to boot a system to a specified image.

TFTP Server

TFTP is a lightweight, minimalistic file transfer protocol designed for simplicity and efficiency. TFTP serves as a basic file transfer mechanism between a client and a server. It’s commonly used during network booting processes, firmware updates, and configuration management. TFTP has a small code footprint and lacks features found in more robust protocols like FTP or SCP. If you need to know more about this protocol, you can follow this link: Trivial File Transfer Protocol — Wikipedia

Foreman uses tftpd-hpa package for handling TFTP protocol.

Kickstart files

Kickstart files are actually answers to questions asked in the process of installing an operating system, e.g. “Choose a username”, “Choose a disk to partition”, “Choose Timezone” and “Choose which packages be available after installation”. Every operating system has a way of accepting kickstart files (some may ask you to put it on the USB stick in a specific directory and some may ask you to provide it via a http server). Meanwhile the syntax of this file varies from an operating system to another one.

In the next part of this series, we will delve more on technical aspects and demonstrate Ubuntu installation on a typical virtual machine.

--

--