Configurator
The configurator is a set of Python scripts and classes that keep track of various bits and pieces of information on all of our machines. This way, configuration files can be easily autogenerated.
Contents |
Basics
The configuration consists of two python classes, UGCSHost and UGSCClass, in UgcsComputers. Each host is represented by a UGCSHost, and can have information set on it. It also may belong to several UGCSClasses. If a script requests some information from a host that it does not have, the host __getattr__ method will look through the classes in an attempt to find it. This way, you can set one piece of information for all hosts in a class easily (example: the 'shellsever' class has the property vlan='ugcs-shell', so any computer that belongs to that class has the property vlan='ugcs-shell' ) The list of classes, hosts, etc is saved in a python pickle dump in /afs/ugcs/ugcs-admin/configurator/machines.pck
UgcsComputers module documentation
UGCSHost
Properties
- ip
- mac
- name
UGCSClass
- UGCSClass(classname, priority)
Methods
- load()
- save()
- add_host(host_instance)
- get_host(hostname)
- get_hosts
- remove_host(hostname)
- rename_host(from, to)
- get_class(classname)
- get_classes
- add_class(class_instance)
How to use
To edit the configuration, start up python in /afs/ugcs/ugcs-admin/configurator and:
from UgcsComputers import * # Load everything we need and some helpers
load() # Read in machines.pck
# Do stuff here
save() # Save the changes
Stuff may include some of the following:
- to be done
Configuration scripts
None of the configuration scripts currently overwrite any files; you must pipe them to the file (or use <script> | sudo tee file) if you want them to actually do something.
create_vmps_db.py
Creates the vmps db for charon. This is typically run on charon; you must scp machines.pck to root@charon:/root/, ssh into charon, and run /root/create_vmps_db.py . It adds all the computers in the classes coreserver, shellserver, and hosted.
generate-demeter-exports.py
Creates the autogenerated part of /etc/exports on demeter. It add /etc/exports.input at the end for static exports. It uses machines from the classes puke-ro and puke-rw, and gets nfs mount information from <host>.nfsmouts, which should be a list of tuples (export, params). If export contains '%s', it is replace with the machine name (just once). Params should typically include ro or rw, no_subtree_check, and no_root_squash.
generate_bind_db.py, generate_bind_rdns.py
These two generate db.ugcs.caltech.edu and db.176.215.131 for bind on demeter. Both use all the hosts and do not care about classes. generate_bind_rdns.py looks for all ips, and if one doesn't exist, substitutes addr-<tail> for the rdns name. generate_bind_db.py uses the classes coreserver, shellserver, and hosted. If a host has extra_dns set, the contents of extra_dns (either a string or a list) will be added after the A record. generate_bind_db.py also looks in /etc/bind/db.ugcs.caltech.edu.input for static stuff (CNAMES,etc), but outputs the header itself.