rconfig - Manage configuration files for many machines via rdist trees.
rconfig [-abdfhlnovV] [-m addr] [-t tagregex] [hosts]
Rconfig is intended to manage configuration files across hetrogenous groups of machines. The configuration for each machine is determined by a set of rdist trees based on the various tags such as OS, hostname, and architecture. Files in 'more specific' rdist trees take priority.
Remote configuration requires passwordless root rsh/ssh from a host with direct access to the rconfig basedir. Target machines will require rdist but not rconfig installed
rconfig has a default set of configuration which can be optionally overridden by $SYSCONFDIR/rconfig.conf, and then $basedir/rconfig.conf. The file can continue end of lines with '\' and can include comments with '#'.
The valid configuration directives are:
basedir Base of rconfig tree. Default: '/files/rconfig'
dirtrees Space separated list of directory trees to includes when determining files to push. Files in earlier trees are pushed in preference to those in later ones. See also TAGS. Default: ${fqdn} ${name} ${tags} ${osname}-${osver}-${machine}-${x11} ${osname}-${osver}-${machine} ${osname}-${osver}-${machine_arch}-${x11} ${osname}-${osver}-${machine_arch} ${osname}-${osver}-${x11} ${osname}-${osver} ${osname}-${machine}-${x11} ${osname}-${machine} ${osname}-${machine_arch}-${x11} ${osname}-${machine_arch} ${osname}-${x11} ${osname} common-${x11} common Note: when adding a new tag the 'dirtrees += ${newtag}' syntax will insert the new tag directly after ${name}, if present, otherwise it will append a space then value. This is particularly convenient if a new tag has been added and it should be treated as more important than everything except the machine's name. This feature is disabled after dirtrees is assigned with 'dirtrees = x'.
fping Command name for fping. Default: fping'
fping_opts Options to pass to fping: Default '-i 250'
mustbedir Space separated list of directories. If a dirtree contains a matching entry which is not a directory, abort push. Intended to stop disasters in case someone puts a file called 'usr' in a dirtree, which is pushed would delete the destination directory '/usr'. Default '/ /usr'
path Path setting: Default: "/sbin:/usr/sbin:/bin:/usr/bin:". "${PREFIX}/bin:${PREFIX}/sbin" Note: Path components are separated by : rather than spaces
probe Command name for probe script. Default: '${LIBEXEC}/rconfig_probe'
probe_remote File into which probe script is copied on remote machines Default: '/var/.rconfig_probe';
rcp Command used to copy probe script to remote machine: Default: 'scp'.
rcp_opts Options to pass to rcp: Default '-B'
rdist Command name for rdist. Default: 'rdist6'
rdist_opts Options to pass to rdist. Default: '-A 64 -a 10240 -M 12 -onumchkgroup -onumchkowner'
rdist_except_pat Rdist 'except_pat' (exclude from any push) settings. Default: '/RCS\$ /CVS\$ /.svn\$ ,v\$ /core\$'
rsh Remote shell command. Default: '${LIBEXEC}/rconfig_ssh'. If any options are required you must set to the name of a shell script which then calls the desired commands and options. This is because rdist cannot handle an RDIST_RSH with options.
rsh_timeout Timeout on rsh commands in seconds: Default: 30
shmux Command name for shmux. Default: shmux'
shmux_opts Options to pass to shmux: Default '-S all -Qs -M 12'
subst_ext Extension of files to parse for substitutions. Not yet implemented. Default: '.subst';
Lines with 'directive = value' with set a directive.
Lines with 'directive += value' will append a space (or : in the case of path) then value to a directive, with the exception of dirtrees (explained above).
Lines with 'directive -= value' will remove a (space or colon separated) value from a directive.
rconfig reads the list of hosts to configure from 'basedir/hosts.conf'.
A slight performance gain can be obtained by keeping slower hosts away from the end of the file.
The default set of tags consists of the hostname plus those determined by running the rconfig_probe script on the destination machine. They are:
name hostname, with any domain information trimmed osname uname -s osver uname -v machine uname -m machine_arch uname -p (if uname supports this) redhat Redhat Linux version number (or blank) x11 x11 or nox11, depending on the existance of /usr/X11R6/lib/libX11.so or /usr/X11R6/lib/libX11.a
Additional tags may be specified after each host in the hosts.conf file, in the form tag=value, in a whitespace separated list. The value can be a comma separated list.
Tags are used to determine the set of dirtrees to check for a given host. If a tag used in a dirtree is not set for a given host, that dirtree is skipped.
For example to add a set of primary and secondary dns servers:
- Update some hosts in hosts.conf to add 'dns=pri' or 'dns=sec' - Add 'dirtrees += dnsserv-${dns}' entry in rconfig.conf - Create 'server-pri' and 'server-sec' trees in basedir
Hosts specified on the command line can be followed by +tag=value to set a specific tag or tags. For example to push to newhost with 'foo' set to 'bar' and 'bun' set to 'dy':
'rconfig -f newhost+foo=bar+bun=dy'
It is intended that at some future point a chrooted area on a target host could be configured by setting chroot=/path in hosts.conf. NOTE: THIS HAS BEEN IMPLEMENTED FOR THE PROBE STATE, BUT NOT YET FOR THE RDIST.
Hosts are pinged using fping before a probe is attempted. This stage can be skipped for all hosts by setting fping=SKIP in rconfig.conf, or for individual hosts by setting fping=SKIP for a specific host in hosts.conf.
The probe script determines the default set of tags. A default script is provided in ${LIBEXEC}/rconfig_probe and will be automatically copied to each machine as probed. The probe script runs a series of commands on the target machine and returns the output in a series of lines of the form:
key=value
One of the keys output _must_ be probe_version, the value of which should be changed if the probe script is updated on the master host.
The probe script is relatively configurable. For example, if the osname was desired in lowercase this could be accomplished by adding a 'tr A-Z a-z' in the appropriate place.
Sample contents of basedir for hosts wopr, orac, dora, and zen
# hosts file listing all hosts, one per line hosts.conf
# Files that go to all hosts common/etc/RCS # RCS dir ignored by rconfig common/etc/csh.cshrc common/etc/csh.login common/etc/group common/etc/sshd.conf common/usr/local/bin/<many_scripts>
# Files for specific architecturse netbsd-i386/usr/local/bin/<some_binaries> netbsd-sparc/usr/local/bin/<some_binaries>
# Files for specific OS netbsd/usr/share/locale/iso_8859_1/LC_CTYPE
# Zen has its own sshd.conf, overrriding common one zen/etc/sshd.conf
If you have hostnames that overlap with architecture names or similar is it suggested you change the ${name} entry in dirtrees to host/${name} or similar.