Skip to content

Instantly share code, notes, and snippets.

@xirixiz
Forked from hakuno/.makefile
Created November 24, 2021 12:19
Show Gist options
  • Save xirixiz/97ee0dd4d362189f23434f869bd39542 to your computer and use it in GitHub Desktop.
Save xirixiz/97ee0dd4d362189f23434f869bd39542 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