Chapter 1.4 : Logic tree(s)
This section present a number of howtos for handling node individualization
Those familiar with Puppet or Chef will find the first methodology based on the simple preg_grep(hostname) very familiar.
... Zit iz intentional. ;) I like that way personally.
But to those new to system management and the likes, an explanation is offered. And to the Puppet/Chef die-hards, please read on, this is important.
Basically, the Cluster-Runner, is a node program, executed on each individual nodes at prescribed times. Its duty is to make a decision as to what to do, based on the scripted inputs. But the big deal is the following;
Nodes execute scripts on their own ! Meaning that nodes do the script processing, not a master-cook who then dispatches them.
This particular point of view is important to the Puppet & Chef communauties, as it changes the logic a tidbit.
But to maintain a minimal form of transparency for people who would want to port recipes to Tlaloc, I chose to use the following methodology as a first example to prove a point.
The downsides are quite obvious, Nodes need to transfer execution scripts in whole, scripts are no longer custom-tailored to each node, rather, scripts include the tailoring in their whole. And inter-node communications take on a new perspective as well. But we adress this issue with the Cloud Agent a wee bit later in this manual.
But there are plus sides; and a couple of them influenced my decision in architecturing this system. ;)
The main one is the single point of failure introduced with a master-slave system. The main idea
behind Tlaloc is to get rid of the "masters" in order to grow systems super-large.
Methodology Grep-style
$Node_Name=trim(`hostname`);
$Node_OS=PHP_OS;
$Node_OSVersion=trim(`uname -r`);
... some basic initilization stuff omitted here ...
if (preg_match("/^.*\.servers\.domain\.ext$/",$Node_Name)) {
// we are part of the *.servers.* group
require 'recipes/base_servers.php';
}
if (preg_match("/ns\-[0-9]*\.dmz\..*/",$Node_Name) ) {
// We are a name server in the DMZ, authoritative for DNS & NTP service.
// ie: ns-[01].dmz.*
require 'recipes/dns_authoritative.php';
}
if (preg_match("/app\-[0-9]*\.dmz\..*/",$Node_Name) ) {
// We are an app web server in the DMZ
// ie: app-[01].dmz.*
$File->Replace_Line("/etc/ntpd.conf","^Server ","Server ntp.dmz.domain.com");
$Service->Start("ntpd");
$Package->Install("mini_sendmail");
$Package->Install("php");
...
}
Alternative methods
You can always program 1 recipe per typical service, and have your recipe files distributed through BootP or DHCP on a per-node basis, or per-group basis. (I would tend to prefer this later methodology nowadays, see our DHCP-pxeboot project)