Created
April 16, 2014 21:01
-
-
Save phips/10932697 to your computer and use it in GitHub Desktop.
ansible control Makefile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.PHONY: run test | |
# default inventory file | |
INV ?= dev | |
# default play | |
PLAY ?= site | |
# If a variable file is encrypted with Vault, create a file with the password | |
# in and run the make with SWITCHES including '--vault-password-file FILE'. | |
# Naturally DO NOT put that file in Git! | |
plays := $(wildcard *.yml) | |
help: | |
@echo "make OPTION" | |
@echo "" | |
@echo "where OPTION is one of:" | |
@echo "" | |
@echo "test: Syntax check" | |
@echo "plays: List available plays" | |
@echo "run: Run a play (defaults to \"$(PLAY)\" for inventory \"$(INV)\")" | |
test: | |
@ansible-playbook -i inventory/$(INV) $(PLAY).yml --list-hosts --list-tasks --syntax-check $(SWITCHES) | |
plays: | |
@echo $(sort $(plays:.yml=)) | |
run: | |
@ansible-playbook -i inventory/$(INV) $(PLAY).yml $(SWITCHES) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment