-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
47 lines (31 loc) · 1.08 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
SHELL := $(shell which bash)
SELF := $(patsubst %/,%,$(dir $(abspath $(firstword $(MAKEFILE_LIST)))))
I ?= $(SELF)/kub3lo.ini
INVENTORY ?= $(I)
NAME := $(shell awk -F '[=:][[:space:]]*' '/[[:space:]]*cluster_name[[:space:]]*[=:]/ { print $$2 }' $(INVENTORY) 2>/dev/null)
export
.PHONY: all
all: deploy
.PHONY: deploy
deploy:
cd $(SELF)/ && ansible-playbook -v -i $(INVENTORY) sk4zuzu.kub3lo.$@
.PHONY: proxy
proxy:
ssh -F $(SELF)/.ssh/config $(NAME)-proxy -N
.PHONY: kc kubeconfig
kc kubeconfig:
@echo export KUBECONFIG=$(SELF)/.tmp/$(NAME)/kubeconfig
.PHONY: b become
b become:
@: $(eval BECOME_ROOT := -t sudo -i)
ssh-%:
@echo NOTICE: if you have complex hostnames use "\"ssh -F .ssh/config <tab>\"" auto-completion instead
@ssh -F $(SELF)/.ssh/config $* $(BECOME_ROOT)
.PHONY: build publish
build:
ansible-galaxy collection build --force --verbose
publish: build
shopt -qs failglob && \
ansible-galaxy collection publish \
"$$(ls -1 $(SELF)/sk4zuzu-kub3lo-[0-9].[0-9].[0-9].tar.gz | sort --version-sort | tail -n1)" \
--api-key="$$(cat $(SELF)/.galaxy-key)"