Automating provisioning Arch continued - TLDR

Summarizing how I provision my machines with just the steps to reproduce the process.
configuration
linux
arch
Published

November 26, 2020

This is part 4 of a 4 part series describing how I provision my systems. Links to each part are below:

Introduction

This note is a reference for me to put together my full provisioning pipeline.

Arch USB boot

Follow The Arch guide

From the live boot

Setup WiFi

In the case where I’m doing this on a laptop I’ll likely have to get on WiFi before I can continue.

iwctl
station wlan0 connect <your SSID>  # You can enclose it in quotes if it has spaces
<enter passphrase>
exit
dhcpcd wlan0

Make sure partitions are set up

If you’re not just going to wipe the whole disk you can run lsblk to determine what partitions you have. cfdisk has a nice interface for creating and modifying partitions if necessary. To format the boot partition run:

mkfs.vfat -F32 /dev/<partition>

mkfs.ext4 /dev/<partition> will work for the root partition.

Run the script

bash <(curl -fsSL http://bootstrap.ianpreston.ca)

After that power off, remove the USB and power back on.

Set up ssh keys

Plug in the USB with ssh keys on it. Guide for reference

lsblk  # find where the partition with the keys is stored
mkdir ssh  # make a mount point
sudo mount /dev/sd<something> ssh
cp -R ssh ssh_local  # Have to set permissions on keys (stupid NTFS)
cd ssh_local/CA
chmod 600 host_ca
chmod 600 user_ca
cd ../
chmod +x setup_host.sh
chmod +x setup_user.sh
sudo ./setup_host.sh
./setup_user.sh

Set up WiFi again

nmcli device wifi connect <SSID> password <password>

Run Ansible

The bootstrap script cloned the repository into /srv/recipes. Modify the hosts file in /srv/recipes/ansible/inventor/hosts to include the hostname of the machine you’re setting up in the appropriate categories if you haven’t already.

Run provision_desktop.sh in the ansible folder. It will fail part way through as you won’t have the keys set up for GitHub for your local user. Go through the ssh key generation process again for the newly created user, this will also make a GitHub specific key. Manually add that key to GitHub’s authorized keys and re-run the recipe. I’ve also seen it flake out a few times on particular application installs. Often I can just get past it by running yay -S <application> to manually install the problematic app. At the time of this writing there’s an additional fix required for spotify that’s mentioned on the AUR page for it. I’m not putting that in the recipe as I’m hoping it will be fixed soon.

Setup dotfiles

Log in as your regular user.

cd ~/.dotfiles
./setup.sh
rcup -v

Conclusion

Sure, you could just install Ubuntu and be done with it, but where’s the fun in that? Why not spend weeks yak shaving your setup until you’re perfectly happy with it?