Skip to content

Instantly share code, notes, and snippets.

@martinky
Last active March 18, 2022 03:28
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save martinky/819ca4a9678dad554807b68705bedbcb to your computer and use it in GitHub Desktop.
Save martinky/819ca4a9678dad554807b68705bedbcb to your computer and use it in GitHub Desktop.
Makefile used to run complete Ansible playbooks in parallel on individual hosts using make -jN with added timeout constraint.
HOSTS=host_a host_b
INVENTORY=../data/inventory.inv
PLAYBOOK=../playbooks/test.yml
TIMEOUT=600
deploy: all_hosts
all_hosts: $(HOSTS)
$(HOSTS):
timeout -s KILL $(TIMEOUT) ansible-playbook -i $(INVENTORY) $(PLAYBOOK) -l $@
touch $@
clean:
rm -f $(HOSTS)
@rmetzler
Copy link

I'm not sure when I gonna need this, but I bet I will. Thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment