-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
36 lines (29 loc) · 896 Bytes
/
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
DOCKER_SSH_KEY := $(shell cat ~/.ssh/id_rsa.pub)
NODE_IP := 172.53.0.10
NODE_NAME := balancer-test
NETWORK := balancer
SUBNET := 172.53.0.0/16
USER := $(or ${user},${user},root)
ENV := $(or ${env},${env},local)
INVENTORY := inventories/$(ENV)
.PHONY : test
network-create:
docker network create --subnet=$(SUBNET) $(NETWORK) || true
network-remove:
docker network rm $(NETWORK) || true
server:
make network-create
docker run --net $(NETWORK) --ip $(NODE_IP) --name $(NODE_NAME) -itd -P -e SSH_KEY="$(DOCKER_SSH_KEY)" gurkalov/ubuntu-ssh:bionic
sleep 1
ssh-keyscan -t rsa -H $(NODE_IP) >> ~/.ssh/known_hosts
down:
docker rm -f $(NODE_NAME) || true
ssh-keygen -f ~/.ssh/known_hosts -R $(NODE_IP)
make network-remove
setup:
ansible-playbook -i $(INVENTORY) -u $(USER) bootstrap.yml
ansible-playbook -i $(INVENTORY) -u $(USER) server.yml
reboot:
make down
make server
make setup