[opensuse-autoinstall] custom rules
Hi, I need to match against some hostnames for selecting a profile. I have sth. like <rule> <custom1> <script> <![CDATA[ #!/bin/sh . /var/lib/dhcpcd/dhcpcd-eth0.info echo -n $HOSTNAME ]]> </script> <match>*</match> <match_type>exact</match_type> </custom1> <result> <profile>profiles/part_@custom1@_keep.xml</profile> <continue config:type="boolean">true</continue> </result> </rule> But now I want to select one profile for 10 certain hostnames. How can I do that in an elegant way? What I can do is rewrite the <custom1><script>...</script><match>...</custom1> part 10 times and AY will redo that script 10 times. But since AY saves the value of "$custom1" while working on rules.xml (seenin y2log), it should be possible to reuse the determined value instead of redefining it over and over again. However, <rule> <custom1> <match>turing</match> </custom1> ... </rule> redefines $custom1 to "" instead of working on the former value. Is it possible to re-use the value for custom1 when a former rule has defined it to some value? If not, I vote for adding this feature! cu Frank -- Dipl.-Inform. Frank Steiner Web: http://www.bio.ifi.lmu.de/~steiner/ Lehrstuhl f. Bioinformatik Mail: http://www.bio.ifi.lmu.de/~steiner/m/ LMU, Amalienstr. 17 Phone: +49 89 2180-4049 80333 Muenchen, Germany Fax: +49 89 2180-99-4049 * Rekursion kann man erst verstehen, wenn man Rekursion verstanden hat. * -- To unsubscribe, e-mail: opensuse-autoinstall+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-autoinstall+help@opensuse.org
On Mon, Feb 11, 2008 at 01:19:25PM +0100, Frank Steiner wrote:
But now I want to select one profile for 10 certain hostnames. How can I do that in an elegant way?
If it's not too hard to do it at boot time, rather then trying to script it to know specific hostnames, and then having to update the script anytime that list changed, you could just add some keyword on the kernel cmdline to trigger your special thing and do that. Could do something like.. Add to cmdline: dospecial Do something in script like: <rule> <custom1> <script> <![CDATA[ #!/bin/sh if [ -n "`grep dospecial /proc/cmdline`" ] then echo special else . /var/lib/dhcpcd/dhcpcd-eth0.info echo -n $HOSTNAME fi ]]> </script> <match>*</match> <match_type>exact</match_type> </custom1> <result> <profile>profiles/part_@custom1@_keep.xml</profile> <continue config:type="boolean">true</continue> </result> </rule> Assuming that you wanted the same special profile file for all of the matching hosts. Could also do a custom2 or append something onto hostname for @custom1@ value. We do come initial disk slicing profiles and such like this.. using a profile=<profile> in cmdline. We also pass the hostname via host=<hostname>. You can add what you want to cmdline as long as you don't clash with any existing keywords of course. And if you're on sles/sled10-sp1+ they included the kernel patches to allow 2048 characters on cmdline vs the old 256 char default (which is a lot shorter then you might think). I actually patched the same patch into our sles9-sp3 installs because it was very helpful being able to pass our long nfs mount paths for both autoyast= and install= on the cmdline. -- Mike Marion-Unix SysAdmin/Staff IT Engineer-http://www.qualcomm.com George: "You don't work in the rain? You're a mailman... Neither Rain, nor sleet, nor sno-IT'S THE FIRST ONE!" ==> Seinfeld -- To unsubscribe, e-mail: opensuse-autoinstall+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-autoinstall+help@opensuse.org
Mike Marion wrote
That would mean different pxelinux.cfg stuff for different hosts.
Ok, that gave me the idea. Of course I can do sth. like "case $HOSTNAME in a|b|c) echo blabla" in the custom script. reaching the same effect as your script, but by listing the hostnames in the script/profile instead of a case distinction on the kernel command line (that would be much more difficult in our setup). Thanks for the hint! cu, Frank -- Dipl.-Inform. Frank Steiner Web: http://www.bio.ifi.lmu.de/~steiner/ Lehrstuhl f. Bioinformatik Mail: http://www.bio.ifi.lmu.de/~steiner/m/ LMU, Amalienstr. 17 Phone: +49 89 2180-4049 80333 Muenchen, Germany Fax: +49 89 2180-99-4049 * Rekursion kann man erst verstehen, wenn man Rekursion verstanden hat. * -- To unsubscribe, e-mail: opensuse-autoinstall+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-autoinstall+help@opensuse.org
On Tue, Feb 12, 2008 at 09:57:27AM +0100, Frank Steiner wrote:
That would mean different pxelinux.cfg stuff for different hosts.
Which is pretty simple if you base it off the mac address or hex value of the IP. Can easily do something like 2 config files, one that is default, one that is the special case, and just use symlinks to those 2 files based on the mac or ip.
True.. it's shell so it's pretty flexible.
Thanks for the hint!
No problem. I've gotten a lot of help of the list here and love being able to give back when I can. Our installs have gotten pretty complex but really use the power of autoyast. I've setup a system where we have a script to setup the initial pxelinux.cfg/01-<mac> files to start the install (and some files in an NFS path our post scripts use for customizations). A pre-script to rewrite the autoyast profile on the fly to set the hostname, IP, initial DNS and such (which each of our office sites and customize in a config file). Chroot and post scripts to setup the base suse install to then run our company CRM system on top of that. Autoyast has a lot of flexibility in each of these stages. Next I'm going to be working on the pre-script to do a more dynamic partitioning scheme based on disk size and requested size of swap to allow people to give more/less swap. We have some huge ram hosts for big jobs and are finding a need to play with swap values more. -- Mike Marion-Unix SysAdmin/Staff IT Engineer-http://www.qualcomm.com [Bart's up in the treehouse] Marge: "What do you think he's doing up there?" Homer: "I don't know... Drug lab?" Marge: "Drug Lab!?!?" Homer: "Or reading comic books. What am I? Kreskin? You tell me what he's doing!" ==> Simpsons -- To unsubscribe, e-mail: opensuse-autoinstall+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-autoinstall+help@opensuse.org
On Mon, Feb 11, 2008 at 01:19:25PM +0100, Frank Steiner wrote:
But now I want to select one profile for 10 certain hostnames. How can I do that in an elegant way?
If it's not too hard to do it at boot time, rather then trying to script it to know specific hostnames, and then having to update the script anytime that list changed, you could just add some keyword on the kernel cmdline to trigger your special thing and do that. Could do something like.. Add to cmdline: dospecial Do something in script like: <rule> <custom1> <script> <![CDATA[ #!/bin/sh if [ -n "`grep dospecial /proc/cmdline`" ] then echo special else . /var/lib/dhcpcd/dhcpcd-eth0.info echo -n $HOSTNAME fi ]]> </script> <match>*</match> <match_type>exact</match_type> </custom1> <result> <profile>profiles/part_@custom1@_keep.xml</profile> <continue config:type="boolean">true</continue> </result> </rule> Assuming that you wanted the same special profile file for all of the matching hosts. Could also do a custom2 or append something onto hostname for @custom1@ value. We do come initial disk slicing profiles and such like this.. using a profile=<profile> in cmdline. We also pass the hostname via host=<hostname>. You can add what you want to cmdline as long as you don't clash with any existing keywords of course. And if you're on sles/sled10-sp1+ they included the kernel patches to allow 2048 characters on cmdline vs the old 256 char default (which is a lot shorter then you might think). I actually patched the same patch into our sles9-sp3 installs because it was very helpful being able to pass our long nfs mount paths for both autoyast= and install= on the cmdline. -- Mike Marion-Unix SysAdmin/Staff IT Engineer-http://www.qualcomm.com George: "You don't work in the rain? You're a mailman... Neither Rain, nor sleet, nor sno-IT'S THE FIRST ONE!" ==> Seinfeld -- To unsubscribe, e-mail: opensuse-autoinstall+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-autoinstall+help@opensuse.org
Mike Marion wrote
That would mean different pxelinux.cfg stuff for different hosts.
Ok, that gave me the idea. Of course I can do sth. like "case $HOSTNAME in a|b|c) echo blabla" in the custom script. reaching the same effect as your script, but by listing the hostnames in the script/profile instead of a case distinction on the kernel command line (that would be much more difficult in our setup). Thanks for the hint! cu, Frank -- Dipl.-Inform. Frank Steiner Web: http://www.bio.ifi.lmu.de/~steiner/ Lehrstuhl f. Bioinformatik Mail: http://www.bio.ifi.lmu.de/~steiner/m/ LMU, Amalienstr. 17 Phone: +49 89 2180-4049 80333 Muenchen, Germany Fax: +49 89 2180-99-4049 * Rekursion kann man erst verstehen, wenn man Rekursion verstanden hat. * -- To unsubscribe, e-mail: opensuse-autoinstall+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-autoinstall+help@opensuse.org
On Tue, Feb 12, 2008 at 09:57:27AM +0100, Frank Steiner wrote:
That would mean different pxelinux.cfg stuff for different hosts.
Which is pretty simple if you base it off the mac address or hex value of the IP. Can easily do something like 2 config files, one that is default, one that is the special case, and just use symlinks to those 2 files based on the mac or ip.
True.. it's shell so it's pretty flexible.
Thanks for the hint!
No problem. I've gotten a lot of help of the list here and love being able to give back when I can. Our installs have gotten pretty complex but really use the power of autoyast. I've setup a system where we have a script to setup the initial pxelinux.cfg/01-<mac> files to start the install (and some files in an NFS path our post scripts use for customizations). A pre-script to rewrite the autoyast profile on the fly to set the hostname, IP, initial DNS and such (which each of our office sites and customize in a config file). Chroot and post scripts to setup the base suse install to then run our company CRM system on top of that. Autoyast has a lot of flexibility in each of these stages. Next I'm going to be working on the pre-script to do a more dynamic partitioning scheme based on disk size and requested size of swap to allow people to give more/less swap. We have some huge ram hosts for big jobs and are finding a need to play with swap values more. -- Mike Marion-Unix SysAdmin/Staff IT Engineer-http://www.qualcomm.com [Bart's up in the treehouse] Marge: "What do you think he's doing up there?" Homer: "I don't know... Drug lab?" Marge: "Drug Lab!?!?" Homer: "Or reading comic books. What am I? Kreskin? You tell me what he's doing!" ==> Simpsons -- To unsubscribe, e-mail: opensuse-autoinstall+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-autoinstall+help@opensuse.org
participants (2)
-
Frank Steiner
-
Mike Marion