[OpenAFS] scripts to install openafs

Andy Cobaugh phalenor@gmail.com
Fri, 1 Oct 2010 11:58:57 -0400 (EDT)


On 2010-10-01 at 08:39, David Bear ( David.Bear@asu.edu ) said:
> It seems that once a year I end up getting a kernel update that breaks afs
> and then I need to install again... but with a fixed kmod -- or something
> else. I know a lot can and should be scripted -- but I've never taken the
> time. So I was hoping someone on the list may have a scripted install of afs
> for a Red Hat system -- actually, I run CentOS but they are the same enough
> that it shouldn't matter. Preferably, the script should look at the
> currently running kernel, then know enough to grab the latest stable openafs
> rpms and install them -- A followup script would be nice the would either
> update the kmod or the dkms afs package as well...  Any pointers, code,
> adivce would be helpful.

Here's what we do, which isn't quite what you're asking for, but might 
give you some ideas.

First, We use cfengine2 to handle all of our config management. We have 
everything set up in such a way that cf2 will do /everything/ necessary 
after the initial kickstart, where %post installs cfengine and pulls down 
a basic update.conf to bootstrap cf2.

We publish our own yum repos. We exclude=kernel* in the Base and Updates 
repos. We then place corresponding kmod-openafs and kernel packages in the 
repo. In this way, we can handle exactly when kernels are updated, and can 
be sure that we'll never be in a situation where there aren't kmod-openafs 
packages yet for new kernel packages. We've been in that situation before, 
it sucks ;)

We then have something like this in cfengine:

classes:
         centos::
                 # do we have openafs.ko for the running kernel?
                 app_openafs_has_module = ( ReturnsZeroShell(/sbin/modinfo openafs >/dev/null 2>&1) )
                 app_openafs_has_kmod_installed = ( ReturnsZeroShell(/bin/rpm -q kmod-openafs >/dev/null 2>&1) )

shellcommands:
         # dangerous: if kmod-openafs is installed but modinfo openafs returns nothing,
         # assume kmod-openafs was not installed for the currently running kernel and reboot
         # with the hopes of booting into a kernel with openafs.ko
         centos.app_openafs_has_kmod_installed.!app_openafs_has_module::
                 "/sbin/shutdown -r +5 \"cfengine\: reboot in 5 minutes to try and fix openafs\"" ifelapsed=10 useshell=true

That just handles the state after initial install. There are other fairly 
standard entries in the editfiles, copy, and packages section to make sure 
everything else (ThisCell, /etc/sysconfig/openafs, etc) are in the desired 
state.

As far as rebooting machines to upgrade kernels, people reboot our 
workstations often enough that there's a pretty good chance they're 
running the latest installed kernel. Otherwise we know for sure when 
there's a new kernel to upgrade to, as we'll have dropped the appropriate 
packages in the yum repo, so we can do various things to reboot machines 
after they've done their nightly updates, assuming nobody is logged in.

Hopefully that gives you /some/ idea of how one site handles openafs on 
centos. We've gotten away from using scripts to handle things in favour of 
doing things the cfengine way: defining the desired system state, and 
allowing the machines to converge on their own.

--andy