Config paths and scripts

Matthew Pounsett matt at conundrum.com
Fri Apr 21 16:10:20 CEST 2023


On Fri, Apr 21, 2023 at 8:34 AM Marc Hoppins via linux-fai
<linux-fai at uni-koeln.de> wrote:
>
> In our 50-host we have
>
>     *-dbnode*)
>         echo "FAIBASE UBUNTU JAMMY64 WIPEALL BOND JUMBO-DBNODE GRUB_EFI" ;;
>
> Am confused as to why these are as they are.
>

That defines the classes assigned to a host.  Which classes are
assigned to a host defines which scripts get run, which config files
get copied, etc.  So yes, it's expected that those class names will
appear in a variety of places—attached to different types of files or
directories—in the FAI config.

If you have an existing interface script which needs to behave
similarly, but have some slight variation, depending on some
predictable feature of the host, you can approach that in a few
different ways.
1) You can run entirely different scripts depending on the classes
defined by having slightly different versions of the same script in
/srv/fai/scripts/CLASS1/30-interface,
/srv/fai/scripts/CLASS2/30-interface, etc.  This route might make
sense if you have a small number of types of setups, and there is
little overlap in the way those setups work.
2) You could do explicit tests in the script for which classes are
defined and make relevant choices.
3) You can set up environment variables based on defined classes and
use those variables in  your scripts

I'm probably forgetting other possible approaches.  FAI is sometimes
frustratingly flexible. :)  The hardest part can be picking from the
many, many different possible approaches.

I use (3) for site-specific configurations.  So, as an example:

% cat /srv/fai/config/class/SITE_NYC.var
DOMAIN="nyc.example.com"
GATEWAY_4="192.0.2.1"
MASK_4='24'
NAMESERVERS_4="192.0.2.53 192.0.2.54"
GATEWAY_6="2001:DB8::1"
MASK_6='64'
NAMESERVERS_6="2001:DB8::53 2001:DB8::54"

Every host has one SITE_* class assigned to it, and my network setup
script expects to find these environment variables defined.

One way you might be able to use this approach for your situation is
to have a LINKAGGREGATED class.  You could either use that to define
some variables (/srv/fai/config/class/LINKAGGREGATED.var), or you
could have a test in your 30-interfaces script to see if that class is
defined, and have a minor modification to the behaviour of the script
in that situation.  Which will work better for you depends on the
details of your setup, and on how you prefer to work.


More information about the linux-fai mailing list