Skip to content

Instantly share code, notes, and snippets.

@hakuno
Created November 12, 2020 17:42
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save hakuno/57b41fa2dbea0da941dda1bc5dbb500f to your computer and use it in GitHub Desktop.
Save hakuno/57b41fa2dbea0da941dda1bc5dbb500f to your computer and use it in GitHub Desktop.
Run Ansible Playbook in .makefile
# I found at https://dreisbach.us/articles/simple-ansible-makefile/
# Replace this
# ansible-playbook -i hosts --vault-password-file=.vault-password.txt site.yml
# For this
tags = $(subst roles/,,$(wildcard roles/*))
.PHONY: all $(tags)
all:
ansible-playbook -i hosts --vault-password-file=.vault-password.txt site.yml
$(tags):
ansible-playbook -i hosts -t $@ --vault-password-file=.vault-password.txt site.yml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment