-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
46 lines (35 loc) · 1.47 KB
/
Copy pathMakefile
File metadata and controls
46 lines (35 loc) · 1.47 KB
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
ANSIBLE_PLAYBOOK ?= site.yaml
BOOTSTRAP_PLAYBOOK ?= bootstrap.yaml
ANSIBLE_LINT_PLAYBOOKS ?= $(BOOTSTRAP_PLAYBOOK) $(ANSIBLE_PLAYBOOK)
ANSIBLE_FLAGS ?=
.PHONY: help
help: ## Show this help
@awk 'BEGIN {FS=":|##"} \
/^#--/ {gsub(/^#--[ \t]*/, "", $$0); printf "\033[33m%s\033[0m\n", $$0; next} \
/^[A-Za-z0-9_.\/-]+:.*##/ { \
target = $$1; gsub(/[ \t]+$$/, "", target); \
deps = $$2; gsub(/^[ \t]+|[ \t]+$$/, "", deps); \
desc = $$3; gsub(/^[ \t]+|[ \t]+$$/, "", desc); \
if (deps == "") deps = "(no deps)"; \
printf "\033[32m %-30s\033[0m %-25s %s\n", target, deps, desc; \
}' $(MAKEFILE_LIST)
.PHONY: bootstrap ansible/install deps bootstrap/apply lint syntax check apply
#-- Bootstrap
bootstrap: ansible/install deps bootstrap/apply ## Install Ansible, collections, and bootstrap users
ansible/install: ## Install Ansible tools into the system
sudo pacman -S --needed ansible-core ansible-lint
deps: ## Install Ansible Galaxy collections
ansible-galaxy collection install -r requirements.yaml
bootstrap/apply: ## Apply bootstrap playbook
./$(BOOTSTRAP_PLAYBOOK) --ask-become-pass $(ANSIBLE_FLAGS)
#-- Checks
lint: ## Run ansible-lint
ansible-lint $(ANSIBLE_LINT_PLAYBOOKS) --offline
syntax: ## Run playbook syntax check
ansible-playbook $(BOOTSTRAP_PLAYBOOK) --syntax-check
ansible-playbook $(ANSIBLE_PLAYBOOK) --syntax-check
check: syntax lint ## Run all checks
#-- Apply
apply: ## Apply playbook locally
./$(ANSIBLE_PLAYBOOK) $(ANSIBLE_FLAGS)
.DEFAULT_GOAL := help