Skip to content

Instantly share code, notes, and snippets.

@kostja
Last active October 15, 2020 11:03
Show Gist options
  • Save kostja/bfb493359e3867d27c46 to your computer and use it in GitHub Desktop.
Save kostja/bfb493359e3867d27c46 to your computer and use it in GitHub Desktop.
Ansible vs. GNU Make
instances := $(basename $(wildcard *.lua))
hosts := n4 n6 n11 n12 n16 n17 n18 n19 n20
all:
echo "nothing"
start: clean
$(foreach i, $(instances), tarantoolctl $@ $i;)
stop:
$(foreach i, $(instances), tarantoolctl $@ $i;)
clean:
rm -f *.log *.control *.pid
reset: clean
rm -r $(instances)
load:
cd ~/auriga/bin; rm loader.log; ./run.sh dataloader >> loader.log 2<&1 &
snapshot:
killall -USR1 tarantool
deploy:
$(foreach h, $(hosts), tar -C ~ -cf - .config/tarantool/ | ssh $h "tar xf -";)
$(foreach h, $(hosts), tar -C ~ -cf - auriga/bin/ | ssh $h "tar xf -";)
$(foreach h, $(hosts), tar -C ~ -cf - auriga/config/ | ssh $h "tar xf -";)
$(foreach h, $(hosts), tar -C ~ -cf - local/var/ | ssh $h "tar xf -";)
# $(foreach h, $(hosts), tar -C ~ -cf - local/var/Makefile | ssh $h "tar xf -";)
start-all: start
$(foreach h, $(hosts), ssh $h make -C ~/local/var start;)
stop-all: stop
$(foreach h, $(hosts), ssh $h make -C ~/local/var stop;)
$(foreach h, $(hosts), ssh $h killall java;)
load-all: load
$(foreach h, $(hosts), ssh $h make -C ~/local/var load;)
snapshot-all: snapshot
$(foreach h, $(hosts), ssh $h make -C ~/local/var snapshot;)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment