[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cobbler
Subject:    =?utf-8?b?W2NvYmJsZXJd?= Re: Multiple subnets, multiple dhcp --dhcp-tag, profiles, distro
From:       Greg Chavez <greg.chavez () gmail ! com>
Date:       2016-06-12 15:19:04
Message-ID: CAMTcKhbWeGEXhzOXocde=QAPeZJ+vUd2PuQtp347dN-bDTcaCw () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Hi Tory,

This is a little bit late, but I've been handling the issue of multiple
next-servers by using Cheetah templating code in dhcp.template. I started
with 3 data centers  -- A, B, and C -- which all had a cobbler instance
repliacted from a master cobbler server (the only one with cobbler-web).

On each cobbler server, I defined a unique $tag_pattern to be matched
against each system object's dhcp_tag.

If CobblerA recognized that a system object's dhcp_tag matched its
$tag_pattern, it created a dhcpd host definition with the appropriate
next-server (pulled from CobblerA 's /etc/cobbler/settings).

Systems that were not set with netboot-enable=True or did not match the
$tag_pattern were skipped. This resulted in a clean dhcpd.conf, containing
only the host definitions relevant for that network.

It would be a simple matter to update my template for multi-homed Cobbler
servers with a Cheetah if statement that examined the system object's
gateway and assigned a different next-server value.

Here's my dhcp.template. If you're still struggling with too much
complexity and/or uncertainty, I hope this helps.

# Cobbler managed dhcpd.conf file
#
# generated from cobbler dhcp.conf template ($date)
# Do NOT make changes to /etc/dhcpd.conf. Instead, make your changes
# in /etc/cobbler/dhcp.template, as /etc/dhcpd.conf will be
# overwritten.
#
# ******************************************************************
authoritative;
allow booting;
allow bootp;

option domain-name "example.com";
option domain-name-servers 10.10.148.12;
option ntp-servers 10.10.148.12;
option routers 10.10.148.1;

ddns-update-style interim;
default-lease-time 10800;
max-lease-time 10800;

log-facility local4;

key ddns_key {
  algorithm hmac-md5;
  secret "XXXXXXXXXXXXXXXXXXXXXX";
}

subnet 10.10.148.0 netmask 255.255.252.0 {
     option routers             10.10.148.1;
     option domain-name-servers 10.10.148.12;
     option domain-name "example.com";
     option subnet-mask         255.255.252.0;
     filename                   "/pxelinux.0";
     next-server                $next_server;
}

# For kicking OpenStack Compute nodes
subnet 192.168.241.0 netmask 255.255.255.0 {
     option routers             192.168.241.1;
     option domain-name-servers 192.168.241.10;
     option domain-name         "example.com";
     option subnet-mask         255.255.255.0;
     filename                   "/pxelinux.0";
     next-server                192.168.241.10;
}

#import re
#set $tag_pattern = $re.compile("^cobbler_A")
#for dhcp_tag in $dhcp_tags.keys():
#unless $tag_pattern.match($dhcp_tag) # <-- add the if statement
#continue                                         #       after this line
to
#end unless                                             #       determine
next_server
# group for Cobbler DHCP tag: $dhcp_tag
group {
        #for mac in $dhcp_tags[$dhcp_tag].keys():
            #set iface = $dhcp_tags[$dhcp_tag][$mac]
    host $iface.name {
        hardware ethernet $mac;
        #if $iface.ip_address:
        fixed-address $iface.ip_address;
        #end if
        #if $iface.hostname:
        option host-name "$iface.hostname";
        #end if
        #if $iface.subnet:
        option subnet-mask $iface.netmask;
        #end if
        #if $iface.gateway:
        option routers $iface.gateway;
        #end if
        filename "$iface.filename";
        ## Cobbler defaults to $next_server, but some users
        ## may like to use $iface.system.server for proxied setups
        next-server $iface.next_server;
    }
        #end for
}
#end for

On Thu, May 5, 2016 at 9:50 PM, Tory M Blue <tmblue@gmail.com> wrote:

> Okay just circling back.
>
> So some of this was my misunderstanding and my days of trying to
> modify the "template" (it's not the actual kickstart file), as well as
> mis understanding what Cobbler's role in this whole thing was. So what
> I was after was not really even possible, thanks to NACC on the
> #cobbler irc channel, he was able to straighten out my terminology.
>
> So ya Cobbler has no idea and never will (unless you go static!) what
> my clients IP is. This is really an anaconda/pxe issue and not
> Cobbler, Cobbler is creating the kickstart files and stuff out of my
> template, so really I need to attack this from a different angle.. So
> this was much more of me not understanding Cobbler's role in my
> pxebooting process.
>
> NACC found me some cool stuff via the pxelinux and some stuff I can do
> there to get the right information (prevent PXE from traversing the
> network)..
>
> May not get me 100%, but I'm a much better person now that my
> misconceptions have been cleared up.
>
> Sorry Cobbler this was on me, not you!!
>
> Thanks for everyones assistance!
>
> Tory
> _______________________________________________
> cobbler mailing list
> cobbler@lists.fedorahosted.org
> https://lists.fedorahosted.org/admin/lists/cobbler@lists.fedorahosted.org
>



-- 
\*..+.-
--Greg Chavez
+//..;};

[Attachment #5 (text/html)]

<div dir="ltr">Hi Tory,<div><br></div><div>This is a little bit late, but I&#39;ve \
been handling the issue of multiple next-servers by using Cheetah templating code in \
dhcp.template. I started with 3 data centers   -- A, B, and C -- which all had a \
cobbler instance repliacted from a master cobbler server (the only one with \
cobbler-web).</div><div><br></div><div>On each cobbler server, I defined a unique \
$tag_pattern to be matched against each system object&#39;s \
dhcp_tag.</div><div><br></div><div>If CobblerA recognized that a system object&#39;s \
dhcp_tag matched its $tag_pattern, it created a dhcpd host definition with the \
appropriate next-server (pulled from CobblerA &#39;s \
/etc/cobbler/settings).</div><div><br></div><div>Systems that were not set with \
netboot-enable=True or did not match the $tag_pattern were skipped. This resulted in \
a clean dhcpd.conf, containing only the host definitions relevant for that \
network.</div><div><br></div><div>It would be a simple matter to update my template \
for multi-homed Cobbler servers with a Cheetah if statement that examined the system \
object&#39;s gateway and assigned a different next-server value.  \
</div><div><br></div><div>Here&#39;s my dhcp.template. If you&#39;re still struggling \
with too much complexity and/or uncertainty, I hope this \
helps.</div><div><br></div><div><div># Cobbler managed dhcpd.conf \
file</div><div>#</div><div># generated from cobbler dhcp.conf template \
($date)</div><div># Do NOT make changes to /etc/dhcpd.conf. Instead, make your \
changes</div><div># in /etc/cobbler/dhcp.template, as /etc/dhcpd.conf will \
be</div><div># overwritten.</div><div>#</div><div># \
******************************************************************</div><div>authoritative;</div><div>allow \
booting;</div><div>allow bootp;</div><div><br></div><div>option domain-name<span \
class="" style="white-space:pre">	</span>&quot;<a \
href="http://example.com">example.com</a>&quot;;</div><div>option \
domain-name-servers<span class="" \
style="white-space:pre">	</span>10.10.148.12;</div><div>option ntp-servers<span \
class="" style="white-space:pre">	</span>10.10.148.12;</div><div>option routers<span \
class="" style="white-space:pre">		</span>10.10.148.1;</div><div><br></div><div>ddns-update-style<span \
class="" style="white-space:pre">	</span>interim;</div><div>default-lease-time<span \
class="" style="white-space:pre">	</span>10800;</div><div>max-lease-time<span \
class="" style="white-space:pre">	</span>10800;</div><div><br></div><div>log-facility<span \
class="" style="white-space:pre">		</span>local4;</div><div><br></div><div>key \
ddns_key {</div><div>   algorithm hmac-md5;</div><div>   secret \
&quot;XXXXXXXXXXXXXXXXXXXXXX&quot;;</div><div>}</div><div><br></div><div>subnet \
10.10.148.0 netmask 255.255.252.0 {</div><div>        option routers                  \
10.10.148.1;</div><div>        option domain-name-servers 10.10.148.12;</div><div>    \
option domain-name &quot;<a \
href="http://example.com">example.com</a>&quot;;</div><div>        option subnet-mask \
255.255.252.0;</div><div>        filename                            \
&quot;/pxelinux.0&quot;;</div><div>        next-server                        \
$next_server;</div><div>}</div><div><br></div><div># For kicking OpenStack Compute \
nodes</div><div>subnet 192.168.241.0 netmask 255.255.255.0 {</div><div>        option \
routers                   192.168.241.1;</div><div>        option domain-name-servers \
192.168.241.10;</div><div>        option domain-name             &quot;<a \
href="http://example.com">example.com</a>&quot;;</div><div>        option subnet-mask \
255.255.255.0;</div><div>        filename                            \
&quot;/pxelinux.0&quot;;</div><div>        next-server                        \
192.168.241.10;</div><div>}</div><div><br></div><div>#import re</div><div>#set \
$tag_pattern = $re.compile(&quot;^cobbler_A&quot;)</div><div>#for dhcp_tag in \
$dhcp_tags.keys():</div><div><span class="" style="white-space:pre">	</span>#unless \
$tag_pattern.match($dhcp_tag) # &lt;-- add the if statement</div><div><span class="" \
style="white-space:pre">		</span>#continue                                            \
#          after this line to  </div><div><span class="" \
style="white-space:pre">	</span>#end unless                                           \
#          determine next_server</div><div># group for Cobbler DHCP tag: \
$dhcp_tag</div><div>group {</div><div>            #for mac in \
$dhcp_tags[$dhcp_tag].keys():</div><div>                  #set iface = \
$dhcp_tags[$dhcp_tag][$mac]</div><div>      host $<a \
href="http://iface.name">iface.name</a> {</div><div>            hardware ethernet \
$mac;</div><div>            #if $iface.ip_address:</div><div>            \
fixed-address $iface.ip_address;</div><div>            #end if</div><div>            \
#if $iface.hostname:</div><div>            option host-name \
&quot;$iface.hostname&quot;;</div><div>            #end if</div><div>            #if \
$iface.subnet:</div><div>            option subnet-mask $iface.netmask;</div><div>    \
#end if</div><div>            #if $iface.gateway:</div><div>            option \
routers $iface.gateway;</div><div>            #end if</div><div>            filename \
&quot;$iface.filename&quot;;</div><div>            ## Cobbler defaults to \
$next_server, but some users</div><div>            ## may like to use \
$iface.system.server for proxied setups</div><div>            next-server \
$iface.next_server;</div><div>      }<br></div><div>            #end \
for</div><div>}</div><div>#end for</div></div></div><div class="gmail_extra"><br><div \
class="gmail_quote">On Thu, May 5, 2016 at 9:50 PM, Tory M Blue <span \
dir="ltr">&lt;<a href="mailto:tmblue@gmail.com" \
target="_blank">tmblue@gmail.com</a>&gt;</span> wrote:<br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex">Okay just circling back.<br> <br>
So some of this was my misunderstanding and my days of trying to<br>
modify the &quot;template&quot; (it&#39;s not the actual kickstart file), as well \
as<br> mis understanding what Cobbler&#39;s role in this whole thing was. So what<br>
I was after was not really even possible, thanks to NACC on the<br>
#cobbler irc channel, he was able to straighten out my terminology.<br>
<br>
So ya Cobbler has no idea and never will (unless you go static!) what<br>
my clients IP is. This is really an anaconda/pxe issue and not<br>
Cobbler, Cobbler is creating the kickstart files and stuff out of my<br>
template, so really I need to attack this from a different angle.. So<br>
this was much more of me not understanding Cobbler&#39;s role in my<br>
pxebooting process.<br>
<br>
NACC found me some cool stuff via the pxelinux and some stuff I can do<br>
there to get the right information (prevent PXE from traversing the<br>
network)..<br>
<br>
May not get me 100%, but I&#39;m a much better person now that my<br>
misconceptions have been cleared up.<br>
<br>
Sorry Cobbler this was on me, not you!!<br>
<br>
Thanks for everyones assistance!<br>
<div class="HOEnZb"><div class="h5"><br>
Tory<br>
_______________________________________________<br>
cobbler mailing list<br>
<a href="mailto:cobbler@lists.fedorahosted.org">cobbler@lists.fedorahosted.org</a><br>
 <a href="https://lists.fedorahosted.org/admin/lists/cobbler@lists.fedorahosted.org" \
rel="noreferrer" target="_blank">https://lists.fedorahosted.org/admin/lists/cobbler@lists.fedorahosted.org</a><br>
 </div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div \
class="gmail_signature" data-smartmail="gmail_signature">\*..+.-<br>--Greg \
Chavez<br>+//..;};</div> </div>


[Attachment #6 (text/plain)]

_______________________________________________
cobbler mailing list
cobbler@lists.fedorahosted.org
https://lists.fedorahosted.org/admin/lists/cobbler@lists.fedorahosted.org


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic