I played around with this idea and started to think of ways to add
custom scripts that get executed for all roles. Common tasks that are
not specific to a particular role are good examples, like logging of
An example might make it more clear:
So in the slack script, the preinstall, postinstall, and fixfiles
scripts get called for each role. There could be another directory
somewhere, say /slack_scripts that contains a bunch custom scripts.
Each one in that directory would get called by slack and be given the
name of the current role as a parameter.
If /slack_scripts contained a script called logging.sh, it will get
called like ./logging somerole
That script could do whatever you want.
If you want to be able to run a script before the installation, and
another one after the installation, you could have various locations
/slack_scripts/pre and /slack_scripts/post.
So the basic idea is to tell slack to look in 1 (or more, if you want
to be able to do the pre/post stuff) locations for scripts to execute.
To add logging, you just create a logging script in the appropriate
location, you don't need to change slack.
The basic idea is simple to implement. The location of the scripts can
be found in a configuration file located in /etc/slack.conf.
I'd like to implement this feature and submit a patch, but I want
feedback from the community first.
What is expected if the custom script crashes?
- Just keep on truckin?
- Make it configurable? Each script could specify somehow if slack
should go on or not when if it crashes.
Should the script be run if one of the core slack scripts fails?
- Configurable? Some do, some don't?
- maybe just call the script everytime regardless of success/fail, but
make the second argument to the script the exit code?
Let me know what you think.