FAI Classes

Henning Sprang henning_sprang at gmx.de
Thu Jan 17 02:37:10 CET 2008

James wrote:
> [...]
> I've tried reading the wiki and documentation but it sounds like german
> to me (i'm not german).

Erm, really? Which docs you mean? The FAI guide is English, and most
contents in the wiki as well. Is this English that bad that it is so
hard to understand?

> i don't understand where in the /srv/fai/config folders that i need to
> define these classes

You mean define in the way of "assign a class to a specific host at
install time"?

> i'm assuming it would be under /srv/fai/config/class

This is right for the meaning of FAI mentioned above. Scripts in class
are run, and everything they echo is a class assigned to the host that
is currently installed.

Or, do you look for a way to "create" a class in the first place?
There is not really a single place where you need to "register" a class
just create some files belonging to it, scripts to run, package lists,
disk configs, etc.

Let's assume your class LAMP, and you start with the simple examples
configspace to have some basics.

You'd define the list of packages you need for that class in
package_lists/LAMP - something like apache2, php5, mysql-server.

Then, in 10-host-classes, you'd have to add an
echo "LAMP
To the hostname you want to assign to that class.

Then, your host will get these packages.

> Also which scripts attach to those classes.

Scripts in the scripts directory do stuff you would do manually after
you have your software installed: most often, edit or copy configfiles
so they look as you need them.
If you need a specific /etc/apache2/httpd.conf, put it into the
configspace at files/etc/apache2/httpd.conf/LAMP, and create a
script/LAMP/01-copy-config  with an fcopy command - see man fcopy, and
the examples and read the fai-guide (and tell us, which parts are so bad
english, so we can fix it).

> so if i create a file /srv/fai/config/class/PROFILE1
> how do scripts or hooks under /srv/fai/config/scripts/ or
> /srv/fai/config/hooks relate back to that class?

As said above, you don't do anything to "register" the class centrally.
Scripts in /srv/fai/config/scripts/ relate to PROFILE1 if they are
called scripts/PROFILE1 (then you can have only 1 script for this class)
or something like scripts/PROFILE1/01-do-something , where the number
indicated the order to run scripts, and the name can be something
meaningful - you can also add .sh or .cf suffixes, as you wish.

The name of the class dir is a bit misleading - it should (and probably
will be in a new design of the configspace) class-def or something like

> Also how do i define which /srv/fai/config/disk_config file is gonna be
> read?

The same - it defined by the classes a host is assigned to when the
scripts in class run at the very beginning.
If more then one matches, the class defined first will be chosen. (as
always if you have multiple choices - e.g. files to copy with fcopy.

> I don't comprehend text as well as examples.
> So the more examples of actual config scenarios the better for me.

Look at the simple examples in /usr/share/fai-doc/examples/simple -
you're welcome to ask further questions, but please look at the guide
again, and tell us more which sections are too hard to understand... and
if it is a language problem, or just understanding.


More information about the linux-fai mailing list