tumblr / genesis

A tool for data center automation
http://tumblr.github.io/genesis/
Apache License 2.0
156 stars 24 forks source link

From Genesis to Provisioning? #42

Closed ipstatic closed 9 years ago

ipstatic commented 9 years ago

Would you mind documenting or at least giving a hint on how you go from Genesis (and intake/burn in) to provisioning a host? If PXE boot is pointed at Genesis, I don't see how you can provision a host with kickstart for instance. Are you doing something within Genesis to do this process?

roymarantz commented 9 years ago

I'll add some documentation later (busy with high priority project right now)... The short answer is: we generate a custom iPXE menu when a machine netboots[1]. That code looks at the state[2] of the provisioning, kept in collins[3], and tells the node to either run genesis with a particular target mode, run kickstart, or boot off the disk. The kickstart file is also dynamically generated based on the intended use of the machine and its hardware.

[1] the dhcp server always loads undionly.kpxe, then it does a http request to get the menu [2] we have code in Genesis to update this state [3] collins is our inventory and cmdb system

Unfortunately the dynamic menu and kickstart generator is not open sourced (yet), but I'm pretty sure that there are similar open sourced projects or a simple template expander http server can replace it.

I hope this answered your question. If not, ask away. Roy

ipstatic commented 9 years ago

Hey Roy, That helps greatly. One last question, how are you doing the http request from DHCP? Is there a script option I am not aware of or did you bake that into the undionly.kpxe image? Basically I don't need the code to generate the menu or the kickstart, we already do that. I just need to know how to kick off that process when a machine is requesting the menu. Thanks again for your help!

roymarantz commented 9 years ago

here is a sanitized version of what we put into the dhcpd.conf file

subnet 192.168.10.0 netmask 255.255.255.0 { option domain-name "example.com"; option routers 192.168.10.1; option domain-name-servers 192.168.10.2; option subnet-mask 255.255.255.0; range 192.168.10.130 192.168.10.254;

# If a request comes in from ipxe send the Phil url
if exists user-class and option user-class = "iPXE" {
    filename "http://phil.example.com:8080/ipxe/${net0/mac}";
# Otherwise send the ipxe image
} else {
    next-server 192.168.100.2;
    filename "/ipxe/undionly.kpxe";
}

}

There is not much magic there. Roy

On Fri, Sep 11, 2015 at 10:48 AM, ipstatic notifications@github.com wrote:

Hey Roy, That helps greatly. One last question, how are you doing the http request from DHCP? Is there a script option I am not aware of or did you bake that into the undionly.kpxe image? Basically I don't need the code to generate the menu or the kickstart, we already do that. I just need to know how to kick off that process when a machine is requesting the menu. Thanks again for your help!

— Reply to this email directly or view it on GitHub https://github.com/tumblr/genesis/issues/42#issuecomment-139565348.

ipstatic commented 9 years ago

Ah! My own ignorance of iPXE and PXE is showing. I have used the filename directive before but didn't realize it could be used for the menu. Thanks again for all your help. Looking forward to Phil being open sourced in the future.