-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
48 lines (37 loc) · 1.36 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
include tools.mk
help: ##: Display this help menu
@echo "USAGE:"
@echo
@awk -F': ' \
'/##:/ && !/awk/ { print "\t","make",$$1,"-",$$3 }' \
$(MAKEFILE_LIST)
login: build/provision.stamp ##: Log in to the lab environment
ssh -i build/lab_key root@`cat build/ipv4_address`
provision_lab_host: build/provision.stamp ##: Configure lab environment
build/provision.stamp: build/lab_setup.mk.stamp build/lab_key build/ipv4_address
ssh -i build/lab_key root@`cat build/ipv4_address` make -f lab_setup.mk
@touch $@
build/lab_setup.mk.stamp: lab_setup.mk build/lab_key build/ipv4_address | build/
scp -i build/lab_key lab_setup.mk root@`cat build/ipv4_address`:~/
@touch $@
create_lab_host: build/ipv4_address ##: Create an EC2 instance running OmniOS
build/ipv4_address: \
$(TERRAFORM) lab_host.tf build/lab_key.pub build/initialized.stamp
$(TERRAFORM) apply
$(TERRAFORM) output -raw ipv4_address > $@
init: build/initialized.stamp ##: Initialize Terraform for this directory
build/initialized.stamp: \
$(TERRAFORM) providers.tf $(wildcard *.lock.hcl) | build/
$(TERRAFORM) init
@touch $@
build/lab_key build/lab_key.pub: | build/
ssh-keygen -f build/lab_key -N ''
build/:
mkdir $@
clean: $(TERRAFORM) ##: Remove this lab's resources from your AWS account
$(TERRAFORM) destroy
rm -rf \
.terraform \
terraform.tfstate \
terraform.tfstate.backup \
build