Convert simp-packer to build DHCP-based boxes

Description

Currently, simp-packer builds a puppetserver with baked-in host-only networking details, including MAC, IP address, subnet, and gateway. The simpsetup:: class configures bind and dhcpd to anticipate PXE clients with similarly hard-coded MAC addresses and IP addresses.

The tests were originally written in this way because SIMP networks that manage bind (DNS) and DHCP customarily use static addresses (at least for the puppet server), and it's easier to scaffold repeatable tests for hosts with known networking details.

However, this causes some problems:

  • The current VMs will attempt to use the same IPs and subnets using VirtualBox host-only networks

    • This could lead to collisions when CI hosts attempt to run simultaneous integration ona single (shell) runner

    • simp-packer's current samples attempt to make collisions less likely by using different subnets for different samples (fips7 uses host_only_gateway of 192.168.103.1, nofips6* uses 192.168.101.1).

      • However, this doesn't fix the issue—the problem still affects boxes built from the same sample.

  • The baked-in networking makes the SIMP Vagrant boxes unsuitable for distribution from public Vagrant image repositories such as Vagrant Cloud.

We can avoid these problems by configuring simp-packer to build boxes that acquire valid local network details via DHCP—and configured them to static networking (if necessary) using follow-on logic from beaker or other provisioning services.

This is the basic outline:

When packer builds the .box files:

  • Do not specify a MAC address for the Vagrant box(es)

  • Do not specify an IP address for the Vagrant box(es)

  • Configure the box OSes for DHCP:

    • Configure the puppetserver for DHCP (IP from VirtualBox’s DHCP server)

    • Configure any PXE clients (kicked from puppetserver's DHCP server) to use DHCP

When beaker first provisions the SIMP box(es):

  • Stage 1: Bring up ONLY the puppetserver and reconfigure it with the current network settings.

    • A simple way to do this: set up puppetsever in 00_setup_puppetserver_spec.rb and the clients in a later spec file (e.g., 01_setup_clients_spec.rb).

    • Beaker/Virtualbox DHCP gives Puppet server an IP

    • Get network data:

      • Derive MAC + IP addresses of clients (now that they have them) from beaker

      • Derive static subnet from puppetserver’s current subnet

    • Configures the puppetserver using logic from 00_setup_puppetserver_spec

      • (This is possibly a post-packer use case for simp-packer's `simpsetup::` class)

      • Rewrite bind + dhcp with current MACs and IPs for puppetserver and clients (derived from beaker)

      • Rewrite hiera to configure everything to use static networking

      • Run `puppet agent -t` on the puppetserver to make its IP static.

  • Stage 2: Run puppet on client VMs in 01_setup_clients_spec.rb

    • Run `puppet agent -t` on clients to make their IPs static.

  • Stage 3: Test what you were going to test.

Acceptance Criteria

None

Epic Link

None

Story Points

20

Components

Priority

High
Configure