Hacker News new | ask | show | jobs
by patrck 1496 days ago
Seems like it should use m4 instead of sed/awk for the templating. And `make` for the dependencies that will arise, eg. HUP sshd after config change.
1 comments

I've never used m4 directly, but it might be interesting to look at. I'll try to make some time to look around for information on this. If you have any pointers to get started, I'd be very interested.
The gnu m4 manual is the go-to documentation.

One way to think about m4 is as form-substitution, eg. the ssh-config customization via sed.

Another is as text generator, eg. the classic sendmail config generator, where one writes m4 succinctly which in turn generates complex files.

From a 10,000 meter perspective, all the managed servers' config files are a projection from the central config repository. If that config is already an m4 file, then all that's left is finding the variant configs and handling them.

`make` is another nicety, as it handles the dependencies, eg. scp'ing the config and then HUP'ing the daemon only when that config changes.