And come to think of it, I think you'd want to place that Cheetah code *after* the loop begins, so:
#for dhcp_tag in $dhcp_tags.keys(): #if $dhcp_tag == "VLAN1" #set global next_server = <vlan1 IP> #else if $dhcp_tag == "VLAN2" #set global next_server = <vlan2 IP> #else if $dhcp_tag == "VLAN3" #set global next_server = <vlan3 IP> #end if ...<group block> .. #end for
Also, I'm not sure you need the "global" parameter. Frankly, I know very little about Cheetah; I usually get it to work through a trial-and-error process :(
On Wed, May 4, 2011 at 12:25 PM, Greg Chavez greg.chavez@gmail.com wrote:
So, if I add the lines below, where does the VLAN1,VLAN2 and VLAN3 labels come from? - Are they from a another place in the dhcp-template file? - Labels setup per each network interface in Linux? - Elsewhere?
No, you set them in the system object. This can be found under Networking in the web console, or by running "cobbler system edit --name=<system name> --dhcp_tag=<arbitrary value>".
If you do a search for "dhcp_tag" in the cobbler list archives, you should find a thread on how we use it to manage replicated cobbler instances on different subnets.
On Wed, May 4, 2011 at 5:54 PM, Greg Chavez greg.chavez@gmail.com wrote:
On Wed, May 4, 2011 at 11:08 AM, Daniel Kertby kertby@gmail.com wrote:
Hi,
I have setup Cobbler to use DHCP and the cobbler itself resides on multiple VLANs (over a Bond).
My intention is to get the ks=http://<server>/cblr/svc.. to point at the interface if of the Cobbler server for that VLAN.
When adding a system, --server-override=string can be used but I don't want this to be put on the cobbler users -- or additional code for fixing that.
My understanding is that the /etc/cobbler/dhcp.template file can be updated to provide the correct installation server. Is this correct?
Yes. Use the --dhcp-tag system parameter to assign different values to $next_server. For example, let's say you have 3 VLANs. You could assign to --dhcp_tag arbitrary values like "VLAN1", "VLAN2", and "VLAN3". Then, you could add this Cheetah markup to redefine $next_server before the :#for dhcp_tag" loop begins:
#if $dhcp_tag == "VLAN1" #set global next_server = <vlan1 IP> #else if $dhcp_tag == "VLAN2" #set global next_server = <vlan2 IP> #else if $dhcp_tag == "VLAN3" #set global next_server = <vlan3 IP> #end if
At least, I assume this should work. It all depends on whether or not Cobbler allows you to change its built-in variables.
More information here: https://fedorahosted.org/cobbler/wiki/KickstartTemplating and here: https://fedorahosted.org/cobbler/wiki/KickstartSnippets.
--
--Greg Chavez
cobbler mailing list cobbler@lists.fedorahosted.org https://fedorahosted.org/mailman/listinfo/cobbler
cobbler mailing list cobbler@lists.fedorahosted.org https://fedorahosted.org/mailman/listinfo/cobbler
--
--Greg Chavez