-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
65 lines (51 loc) · 1.82 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#########################################
## Preamble
SHELL := /bin/bash
.ONESHELL:
.SHELLFLAGS := -eu -o pipefail -c
.DELETE_ON_ERROR:
MAKEFLAGS += --warn-undefined-variables
MAKEFLAGS += --no-builtin-rules
# Modify the block character to be `-\t` instead of `\t`
ifeq ($(origin .RECIPEPREFIX), undefined)
$(error This Make does not support .RECIPEPREFIX. Please use GNU Make 4.0 or later)
endif
.RECIPEPREFIX = -
#########################################
## Setup
.DEFAULT_GOAL := run
ANSIBLE_DIR := $(shell pwd)/ansible
SENSIBLE_DIR := $(ANSIBLE_DIR)/scripts
ROLES_DIR := $(ANSIBLE_DIR)/roles
#########################################
## Recipes
default: $(.DEFAULT_GOAL)
all: help
.PHONY: help
help: ## List commands
- @echo -e "USAGE: make \033[36m[COMMAND]\033[0m\n"
- @echo "Available commands:"
- @awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\t\033[36m%-20s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
.PHONY: run
run: ## Run sensible and choose which playbooks to run
- @echo "Running Controller Playbook..."
- @python3 $(SENSIBLE_DIR)/sensible.py --dir=$(ANSIBLE_DIR)
# .PHONY: step
# step: ## Run Ansible Playbooks with --step
# - @echo "Stepping through playbook..."
# - @cd $(ANSIBLE_DIR)
# - @ansible-playbook --step playbooks/controller.yml
.PHONY: lint
check: ## Run YAML Lint, Ansible Lint, and remove DOS line endings.
- @echo "Starting the Linting Process"
- @echo "Fixing line endings..."
- @find . -type f -exec sed -i "s|\r$\||" {} \;
- @echo "Running Linter..."
- find $(ANSIBLE_DIR) -type f -name "*.yml" -exec ansible-lint --force-color -p {} \;
- find $(ANSIBLE_DIR) -type f -name "*.yml" -exec yamllint -f colored {} \;
.PHONY: clean
clean: ## Clean up
- @echo "Cleaning..."
- @find ./ -name '*.pyc' -exec rm -f {} \;
- @find ./ -name 'Thumbs.db' -exec rm -f {} \;
- @find ./ -name '*~' -exec rm -f {} \;