-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
49 lines (38 loc) · 1.51 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
SHELL := /bin/bash
# Allows user to specify private hostname in ".inventory file"
PRIVATE_INVENTORY = ".inventory"
ifeq ($(shell test -e $(PRIVATE_INVENTORY) && echo -n yes),yes)
INVENTORY=$(PRIVATE_INVENTORY)
else
INVENTORY = "inventory"
endif
# See https://stackoverflow.com/questions/2214575/passing-arguments-to-make-run/14061796#14061796
SUPPORTED_COMMANDS := install
SUPPORTS_MAKE_ARGS := $(findstring $(firstword $(MAKECMDGOALS)), $(SUPPORTED_COMMANDS))
ifneq "$(SUPPORTS_MAKE_ARGS)" ""
COMMAND_ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
$(eval $(COMMAND_ARGS):;@:)
endif
# Main Ansible Playbook Command (prompts for password)
ANSIBLE=. .tox/py3/bin/activate && ansible-playbook workstation.yml --inventory $(INVENTORY) --ask-become-pass --become
.PHONY: help
help: ## Display help
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
update: clean ## Update this repository
@git pull
@tox
clean: ## Clean tox directory
@rm -Rf .tox/
prepare: ## Install dependencies needed to run this playbook
@sudo apt update
@sudo apt install -y wget curl tar unzip python3 python3-dev python3-pip python3-apt
@sudo pip3 install tox
@tox
check: ## Checks workstation.yml playbook
@$(ANSIBLE) --check
list: ## List all available tags
@$(ANSIBLE) --list-tags
install: ## Run workstation.yml playbook with tags
@$(ANSIBLE) --tags=$(COMMAND_ARGS)
all: ## Install everything from workstation.yml playbook
@echo $(ANSIBLE)