How to have one or more variants of an AutoYaST profile without having to maintain them


Say you maintain a bunch of machines running some SUSE variant, you install them using AutoYaST so they’re all identical but you find that sometimes you want to install a machine in a way which is slightly different to normal. For example, you want to be able to re-install a machine whilst preserving the contents of a particular partition. This presents a problem because it means you need more than one AutoYaST profile, the one you usually use and the variant. If you change the main profile you have to make the same changes to the variant. Maintaining a variant is going to be prone to human error, forgetfulness and possibly problems could be caused by trying to use a variant which you don’t realize hasn’t been maintained.

Faced with such a situation myself a neat solution occurred to me. My AutoYaST profile is retrieved via http from the installation server (running SLES 10 SP2), so a script on the server can be used to manipulate the XML on the fly and serve the modified version. This way only one AutoYaST profile has to be maintained but you can can have as many variants of it as you like provided you write a script to produce that variant. For example;

# N.B. Requires PHP 5
# reads the autoinst.xml file, alters the partition config data so that
# partitions are re-used rather than created and the once mounted at  /local is not formatted
# then outputs the new xml.



foreach ($data->partitioning->drive->partitions->partition as $partition) {
 if ($partition->mount=="/local") $partition->format="false";

header('Content-Type: text/xml');
print $data->asXML();

Save that on your server, provide it’s url as the source of the AutoYaST profile and you can re-install a machine as normal only without losing the contents of the /local partition. If you use PXE boot you can put a suitable entry in to /tftpboot/pxelinux.cfg/default.

I used PHP, but you could of course use perl or whatever other scripting language you may already be comfortable manipulating xml with.

N.B. I have used this method of re-installation whilst preserving the contents of a partition in a production environment without problems. However you should of course make sure you have a backup of any files in the partition that you cannot afford to lose before you do a re-install.

(Visited 1 times, 1 visits today)

Leave a Reply

Your email address will not be published. Required fields are marked *

No comments yet