FreeBSD Provisioning Ansible collection

Hi everyone,

I wanted to share with the community a rather extensive Ansible collection I've been working on for months to provision FreeBSD hosts, taking care of, on a per Ansible role basis:
  • Node bootstrapping (e.g. installing Python, configuring SSH, installing "core" packages, etc).
  • OS patching.
  • Host tuning (e.g. limited hardware configuration, e.g. CPU microcode, power levels, etc.).
  • Boot-time settings (e.g. kernel modules to load, kernel tunables, etc.).
  • Runtime settings (e.g. various runtime sysctl's).
  • Network (e.g. various types of interfaces, DNS resolver, etc.).
  • Monitoring (e.g. boot notifications, SSH abuse, select services availability, etc.).
  • ZFS (pool importing, automated encrypted datasets unlocking, replication, etc.)
  • Users & groups.
  • Samba Server (main configuration, shares configuration, and user management).
  • NFSv4 Server (tuning and shares configuration).
  • NFS Client (tuning and shares mounting).
  • vm-bhyve based VM management.
  • Bastille based jail management.
All of these were developed as a solution to the challenge that migrating my workloads away from TrueNAS CORE posed to me, because I didn't want to continue on the legacy 13.3 OS, but I also didn't want to turn to some new alternative that would, again, completely hijack OS administration away from me.

With this solution, I can fully deploy my workloads to vanilla FreeBSD and retain full control of the OS, either via direct command line administration, updating the roles and inventory configuration and rerunning the automation suite or, most probably, both.

So, without any further ado, here's the source code, with some documentation scattered throughout (top-level README and then per-role README's): https://github.com/AP-Labs-IO/FreeBSD-Provisioning

Like I said, this automation suite was developed over several months to migrate all my workloads away from TrueNAS CORE, and it worked wonders for that in a single pass when I finally pulled the trigger (after much rehearsing in a VM), but, of course, it can still be considered a work in progress. So, please feel free to offer any feedback you might have!

And if you'd like me to describe how I upgraded to vanilla FreeBSD 15.1 on the legacy freenas-boot pool, while preserving the ability to boot back into TrueNAS should there be any need for it (verified, but luckily unnecessary so far), let me know and I'll create a quick write up.

Thank you!

Cc vermaden toddg JohnK
 
Nice! What are your thoughts on pyinfra? It doesn't need Python on the target host as it translates everything to POSIX shell and apparently it's also faster.
 
Nice! What are your thoughts on pyinfra? It doesn't need Python on the target host as it translates everything to POSIX shell and apparently it's also faster.
Thank you for the feedback! I hadn't heard about pyinfra, I'll look into it. But, at least off the top of my head, I'd figure that the savings wouldn't be that big in the long run… like it or not, Python is so ubiquitous now a'days that sooner or later it ends up being installed via some dependency chain, so I guess I just went with the flow and relied on the simplest possible setup for this automation stack.
 
Thanks, I've been liking Ansible for updating my 2 linux boxes and I'd been considering learning it for FreeBSD, but I haven't had much ambition to do so. I'll definitely have to take a look at this and see if there's something to be learned.
 
Thanks, I've been liking Ansible for updating my 2 linux boxes and I'd been considering learning it for FreeBSD, but I haven't had much ambition to do so. I'll definitely have to take a look at this and see if there's something to be learned.
I hope it's useful to you!

As it pertains to Ansible proper, and if you're already familiar with t, I don't think there's much new to learn from this collection, because it's pretty much vanilla Ansible from start to finish, nothing too fancy (so much so that, as you can see in its Galaxy dependencies declaration, I only depend on two very common upstream collections other than ansible.posix).

The value I think this collection does add is that it is very thorough in how it takes a stock FreeBSD installation and automates from start to finish a wide variety of non-trivial configurations over multiple areas that you'd expect to find in either a NAS and/or a virtualization server, as described throughout its varios README files.

Please do let me know if you run into any problems using any of its roles, I've been meaning to add more documentation and usage examples but I've been swamped these last days, so I'm not too sure to what degree what I already wrote is of use to others.

The one thing I would recommend is to snapshot your root volume / boot environment before starting, if possible, so you can revert back to a pristine state in case something doesn't work as expected.
 
Back
Top