Title: How to parallelize Drist Author: Solène Date: 06 February 2019 Tags: drist automation unix Description: This article will show you how to make drist faster by using it on multiple servers at the same time, in a correct way. [What is drist?](https://dataswamp.org/~solene/2018-11-29-drist-intro.html) It is easily possible to parallelize drist (this works for everything though) using Makefile. I use this to deploy a configuration on my servers at the same time, this is way faster. A simple BSD Make compatible Makefile looks like this: SERVERS=tor-relay.local srvmail.tld srvmail2.tld ${SERVERS}: drist $* install: ${SERVERS} .PHONY: all install ${SERVERS} This create a target for each server in my list which will call drist. Typing `make install` will iterate over `$SERVERS` list but it is so possible to use `make -j 3` to tell make to use 3 threads. The output may be mixed though. You can also use `make tor-relay.local` if you don't want make to iterate over all servers. This doesn't do more than typing `drist tor-relay.local` in the example, but your Makefile may do other logic before/after. If you want to type `make` to deploy everything instead of `make install` you can add the line `all: install` in the Makefile. If you use GNU Make (gmake), the file requires a small change: The part `${SERVERS}:` must be changed to `${SERVERS}: %:`, I think that gmake will print a warning but I did not succeed with better result. If you have the solution to remove the warning, please tell me. If you are not comfortable with Makefiles, the .PHONY line tells *make* that the targets are not valid files. Make is awesome! |