cfgfoo

git clone https://orangeshoelaces.net/git/cfgfoo.git

Readme

cfgfoo
Copyright 2018, 2019 Vasilii Kolobkov

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. 

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>.


cfgfoo is a simple configuration management recipe - write shell scripts
to bring the system into a desired state, transfer and execute via ssh
if necessary. Proved feasible for running a single server and believed
to scale reasonably well up to a handful more.

A quick primer:

$ git clone https://orangeshoelaces.net/git/cfgfoo.git
$ mkdir config
$ cat > config/foo <<END
listen on egress
END
$ cat > setup <<END
#!/bin/sh
set -e
. ./cfgfoo/aliases

fs_install {./config,/etc}/foo
eddit_appendfln /etc/bar 'include "/etc/foo"'
rc_start bazd
END
$ chmod 0700 setup
$ cat > upload <<END
tar chzf cfg.tgz cfgfoo config setup
scp cfg.tgz 'root@example.net:~'
rm cfg.tgz
END
$ chmod 0700 upload 
$ cat > rsetup <<END
#!/bin/sh
ssh root@example.net 'nohup ~/setup'
END
$ ./upload && ./rsetup

Configuration script comprise steps. Latter being made of two shell
functions 'step_taken' and 'take_step' driven by a cfgfoo script. As the
names suggest, they are to be idempotent. Steps for some basic operations
are included and you can add your own easily.