ex: chosing host-specific profile (pxe-based)
Hi, here's sth. which didn't work in some earlier versions (don't remember when I last tried it) but is working at least in 10.1 alpha4. I can now use this rule in rules.xml to chose a profile for each host based on its name. This works only if the host gets its name via dhcp, so this is sth. especially nice for pxe-based installations. I provide this as example for other people and hope that someone can make use of it :-) This is a solution for the non-working <hostname> matching, because the <hostname> tag contains the IP and not the hostname, even when using pxe/dhcp. <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@.xml</profile> <continue config:type="boolean">true</continue> </result> </rule> I use this to store partition information per host in a file part_<hostname>.xml in the profile subdir. No need to change the rules.xml anymore, just create the profile with the partition information. In these profiles, I always keep partitions, formatting only / and /var. In case I really really want to destroy and recreate partitions for a specific host, I add another rule afterwards, e.g. <rule> <custom1> <script> <![CDATA[ #!/bin/sh . /var/lib/dhcpcd/dhcpcd-eth0.info echo -n $HOSTNAME ]]> </script> <match>riemann</match> <match_type>exact</match_type> </custom1> <result> <profile>profiles/part_riemann_createnew.xml</profile> <continue config:type="boolean">true</continue> </result> </rule> or, IP-based: <rule> <hostaddress> <match>141.x.x.x</match> <match_type>exact</match_type> </hostaddress> <result> <profile>profiles/part_riemann_keep.xml</profile> <continue config:type="boolean">true</continue> </result> </rule> to override the common selection. Have fun! 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. *
participants (1)
-
Frank Steiner