Last active
August 1, 2017 19:20
-
-
Save kamranayub/03eacf147591cc100300b996b92f3574 to your computer and use it in GitHub Desktop.
Makefile for using ansible-playbook to do syntax checking for YAML playbooks
This file contains hidden or 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
# 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