Lazy client, part IV

October 29, 2008

linux

Ok, so far I’ve created a cfengine setup that works. On my main host ‘elektron’ I’ve created a /export/nfsroot/x86 directory. This holds the general files for the x86 Ubuntu lazy clients. With 2 scripts (see below) I can easily create a whole new x86 from scratch. Bringing up new lazy clients is even more easy, once the groundwork is there. I only need to do three things:

  • fix the DNS (forward and reverse)
  • fix the DHCP and add an ip address.
  • add this ip address to some cfengine file (2 in total)
  • optionally add some extra configuration in cfengine for this specific host.

Create a generic lazy client from scratch

There is one script that creates a new host in a chrooted environment, it starts a debootstrap and after that calls a follow-up script to finish the configuration for this host - after this step cfengine takes over. The second stage script takes care of setting up the sources.list for apt and a preliminary /etc/hosts file. Cfengine fixes everything else.

After this step I can mv the chrooted Linux install to the correct directory and let cfengine take over.

So when installing a completely new lazy client I need to perform the following steps:

1. mkdir linux.$$
2. cd linux.$$
3 ~/lazy/chroot-lazy-p1 x86 dapper (calls chroot-lazy-p2 when finished)
4. cd ..
5. mv linux.$$ /export/nfsroot/x86
6. cfagent -v

Step 6 is the most complex one, it triggers on the existence of the /export/nfsroot/x86 directory, hence step 5 above. When this directory is found the following cfengine script is called: elektron/nfsroot/_init.cf, which in turn will execute other scripts which takes care of the post-configuration of this host.

All the configuration which is done now will be shared by all lazy clients. But as I’ve already written (link to part 3), I may also need some per host configuration. This is done running cfengine as part of the booting process. When this cfengine is running all changes will be made to the ramdisk which holds /etc. Typical tasks may be to setup user accounts and a message of the day which may be different on each lazy client.

#Closing remarks This solution is scalable to – I think – 50 to 100 lazy clients. So for medium sized networks. The initial setup is complicated, but adding new lazy clients is easy enough to be scriptable.

If you want to scale it up more you need to look a thin clients, but those are less powerful and you may need network audio and local devices (USB sticks) may not be fully supported.

None