-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
68 lines (54 loc) · 1.95 KB
/
Copy pathMakefile
File metadata and controls
68 lines (54 loc) · 1.95 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
ANSIBLE_USER ?= margay
ENVIRONMENT ?= kind
MKFILE_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
ANSIBLE_INVENTORY_DIR := $(MKFILE_DIR)/inventories/$(ENVIRONMENT)/ansible
KUBESPRAY_INVENTORY_DIR := $(MKFILE_DIR)/inventories/$(ENVIRONMENT)/kubespray
ANSIBLE_DIR := $(MKFILE_DIR)/ansible
KUBESPRAY_DIR := $(MKFILE_DIR)/kubespray
BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
.ONESHELL:
.PHONY: ansible-requirements
ansible-requirements:
test -d $(ANSIBLE_INVENTORY_DIR)/.venv || python3 -m virtualenv $(ANSIBLE_INVENTORY_DIR)/.venv
. $(ANSIBLE_INVENTORY_DIR)/.venv/bin/activate
pip install -r $(ANSIBLE_DIR)/requirements.txt
mkdir -p $(ANSIBLE_DIR)/collections
ansible-galaxy collection install -r $(ANSIBLE_DIR)/requirements.yml -p $(ANSIBLE_DIR)/collections
## --------------- ##
# Proxmox
## --------------- ##
.PHONY: provision-proxmox
provision-proxmox: ansible-requirements
cd $(ANSIBLE_DIR)
. $(ANSIBLE_INVENTORY_DIR)/.venv/bin/activate
ansible-playbook -i $(ANSIBLE_INVENTORY_DIR)/hosts.yaml playbooks/proxmox/provision.yml -u $(ANSIBLE_USER) -K
.PHONY: build-nodes
build-nodes: ansible-requirements
cd $(ANSIBLE_DIR)
. $(ANSIBLE_INVENTORY_DIR)/.venv/bin/activate
ansible-galaxy collection install -r requirements.yml -p collections
ansible-playbook -i $(ANSIBLE_INVENTORY_DIR)/hosts.yaml playbooks/k8s_nodes/provision.yml -u $(ANSIBLE_USER) -K
## --------------- ##
# Kind
## --------------- ##
.PHONY: build-kind
build-kind:
kind create cluster --name margays-kind
.PHONY: delete-kind
delete-kind:
kind delete cluster --name margays-kind
## --------------- ##
# FluxCD
## --------------- ##
.PHONY: flux
flux:
helm install flux-operator oci://ghcr.io/controlplaneio-fluxcd/charts/flux-operator \
--namespace flux-system \
--create-namespace
## --------------- ##
# E2E
## --------------- ##
.PHONY: bootstrap-kind
bootstrap-kind: build-kind flux
.PHONY: bootstrap
bootstrap: build-nodes build-kubernetes flux