#!/usr/bin/env python from Cheetah.Template import Template base = { 'template' : 'dcache-pool-r710.ks.tmpl', 'tmpl_dir' : '../templates/sl6/', 'tmpl_incl_dir' : '../templates/sl6/include/', 'url' : 'http://mirror.msulocal/mirror/scientific/6.3/x86_64/os', 'netmask_priv' : '255.255.240.0', 'gateway_priv' : '10.10.128.1', 'nameserver_priv' : '10.10.128.8,10.10.128.9', 'ntpserver_priv' : '10.10.128.8', 'netmask_pub' : '255.255.254.0', 'gateway_pub' : '192.41.236.1', 'repo_local' : 'repo --name="AGLT2 Repo 6/x86_64" --baseurl=http://mirror.msulocal/mirror/aglt2/6/x86_64', 'omsa_ver' : 'OMSA_7.1', } node = { 'hostname_short' : 'msufs14', 'hostname_pub' : 'msufs14.aglt2.org', 'dev_priv' : 'em1', 'dev_pub' : 'p3p1', 'ip_priv' : '10.10.128.64', 'ip_pub' : '192.41.236.64', 'disk' : '/dev/disk/by-path/pci-0000:03:00.0-scsi-0:1:0:0', 'rootpw' : '$6$G0Green$HYkspUsxwH6bBhU87cxojUKNYE8SFhayIAE/sFkkc9MZ7bHij7ul.B5LotqJkwfgysuxdndPqDP20vDZoIy3j1', 'omsa_type' : 'per710', } tmpl_src = base['tmpl_dir'] + '/' + base['template'] tmpl = Template(file=tmpl_src, searchList = [base, node]) # simple print #print str(tmpl) #write to file ks = open( 'output/' + node['hostname_short'] + '.ks', 'w') ks.write( str(tmpl) ) ks.close()