How can I document and automate a system's configuration?

Posted by Diomidis Spinellis on Super User See other posts from Super User or by Diomidis Spinellis
Published on 2012-03-30T18:44:28Z Indexed on 2012/03/31 11:33 UTC
Read the original article Hit count: 158

Filed under:
|
|

Having a system's configuration represented by its current state is risky, inefficient, and opaque. At some point you may be left with an unsupported system and no upgrade path. Then configuring a new system compatible with the old is a process or trial and error. Furthermore, if at some point the system is damaged the only option is to go back to the most recent full backup, and try to remember what changes followed from that point. Also, the only way to create a system compatible with the original is through a complete dump/restore. Finally, in such a setup there's no way to know how you solved a particular problem; the only thing you can do is to look at the corresponding configuration files and try to guess what you changed to achieve the desired effect.

Currently for each system I maintain, I keep a log file where I record all system administration activity, starting from the installation: installation options, added packages, changes in configuration files, updates, problem fixes etc. In theory this allows me to (manually) replay all changes to arrive at the current state, or to unroll an erroneous change by executing the reverse commands. However, this process is also inefficient, error-prone, and relies on human judgment.

Another thing I've tried is to put /etc configuration files under version control with git. This helps me document the changes automatically and also apply them on a clean setup. But it's not without problems: git has to run under sudo, passwords and private keys may be stored in the repository, installed packages can't be meaningfully tracked, and git will have a fit if I try to extend this approach to all the system's directories.

I've also thought about performing all changes through shell scripts or makefiles, but I think this process will require a lot of effort and will be fragile.

Are there some better methods or tools that I'm missing?

© Super User or respective owner

Related posts about unix

Related posts about configuration