Config::Maker is perl program, that generates text files from templates and configuration values. It is useful to keep all configuration in one place and configure many different services from that. I wrote it and use it for generating firewall configuration, DNS zone file and dhcp server config for a small network.
The idea is a combination of Embperl and XSLT, except it's not that heavyweight. The template is copied to the output, while substituting directives with respective values from the configuration. The values are refered with paths, that are similar to XPath, but a bit less featurefull.
This module uses Module::Build infrastructure for building. To build it, unpack the source tarball, enter the directory and type:
perl Build.PL ./Build ./Build install
For various options available, please refer to the Module::Build(3pm) documentation.
A Makefile.PL is provided for backwards compatibility. To use it, unpack the source tarball, enter the directory and type:
perl Makefile.PL make make install
For various option available, please refer to the ExtUtils::MakeMaker(3pm) documentation.
The later method (and both methods in newer versions) is understood by the CPAN shell (see cpan(1)). You can use that to install.
The program is normaly invoked via the configit script. It takes a metaconfig as an argument, which governs all the generation. In the metaconfig, a list of configuration sources (files) is given and for each a list of templates that should be instantiated (also files) are given. Result of expanding a template can be saved to a file, piped to a command, or possibly both. If an error is encountered anywhere during the processing, the results are not installed so the previous configuration is not broken. For details refer to configit(1).
configit
There is one additional auxiliary script, run-and-save. It is useful if you generate a script, that shall be run on another machine. Just install the run-and-save script on the target machine and specify ssh machine run-and-save --act target-script-name as a command for given template. This script installs your script as target-script-name and executes it. Don't forget to end your template with #COMMIT to indicate that whole script was transfered. The run-and-save script can also take the name from first line of input.
run-and-save
ssh machine run-and-save --act target-script-name
command
#COMMIT
Jan Hudec bulb@ucw.cz
Copyright 2004 Jan Hudec. All rights reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Config::Maker, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Config::Maker
CPAN shell
perl -MCPAN -e shell install Config::Maker
For more information on module installation, please visit the detailed CPAN module installation guide.