Skip to content

Instantly share code, notes, and snippets.

@kamranayub kamranayub/makefile
Last active Aug 1, 2017

Embed
What would you like to do?
Makefile for using ansible-playbook to do syntax checking for YAML playbooks
# Collect top-level YAML files under plays/ folder
# e.g. plays/upgrade_ansible_tower/upgrade_ansible_tower.yml
# These should only be Ansible playbook files
# i.e. store includes in child includes/ dir
playbooks := $(wildcard plays/*/*.yml)
# Check YAML syntax using ansible-playbook
syntax: $(playbooks)
@GREEN='\033[0;32m'; \
NC='\033[0m'; \
echo "$${GREEN}Checking syntax with ansible-playbook$${NC}"
@# Execute ansible-playbook against each file
@$(foreach playbook, $^, ansible-playbook $(playbook) --syntax-check; )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.