-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
71 lines (49 loc) · 2.36 KB
/
Makefile
File metadata and controls
71 lines (49 loc) · 2.36 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# ==================================================================================== #
# VARIABLES
# ==================================================================================== #
ANSIBLE_PLAYBOOK := playbook.yml
ANSIBLE := ansible-playbook
# ==================================================================================== #
## ===== HELPERS =====
# ==================================================================================== #
## help: Describe all available targets
.PHONY: help
help:
@echo 'Usage: make <target>'
@sed -n 's/^##//p' $(MAKEFILE_LIST) | column -t -s ':' | \
awk 'BEGIN {first=1} /^ *=====/ { if (!first) print ""; print " " $$0; first=0; next } { print " " $$0 }'
# Hidden
.PHONY: all
all: help
# ==================================================================================== #
## ===== INSTALL ANSIBLE =====
# ==================================================================================== #
## install-ansible/apt-based: Install Ansible on apt-based distributions (Ubuntu, Debian, Linux Mint, ...)
.PHONY: install-ansible/apt-based
install-ansible/apt-based:
@echo ">>> Installing Ansible via apt-based PPA…"
sudo apt update
sudo apt install -y software-properties-common
sudo add-apt-repository --yes ppa:ansible/ansible
sudo apt update
sudo apt install -y ansible
@echo ">>> Finished installing Ansible via apt-based PPA"
ansible --version
# ==================================================================================== #
## ===== RUN ANSIBLE =====
# ==================================================================================== #
## bootstrap: Run the playbook to set up the local machine
.PHONY: bootstrap
bootstrap:
@echo ">>> Bootstrapping local developer machine with playbook $(ANSIBLE_PLAYBOOK)…"
@command -v ansible >/dev/null 2>&1 || { \
echo "Error: Ansible not installed, please run 'make install-ansible/{{your-package-manager}}' first"; \
exit 1; \
}
$(ANSIBLE) $(ANSIBLE_PLAYBOOK) -c local --ask-become-pass
# ==================================================================================== #
## ===== INSTALL AND RUN =====
# ==================================================================================== #
## setup/apt-based: Install Ansible on apt-based systems, then run bootstrap
.PHONY: setup/apt-based
setup/apt-based: install-ansible/apt-based bootstrap