vagrant-lab-swarm/Makefile

35 lines
1.0 KiB
Makefile
Raw Permalink Normal View History

2022-11-11 13:07:35 +00:00
.PHONY: help
.DEFAULT_GOAL := help
# Uppercase vars for internal use.
UC = $(shell echo '$1' | tr '[:lower:]' '[:upper:]')
LOG_ERROR = @printf "\n>> \e[0;31m$1\e[0;00m\n\n"
LOG_WARN = @printf "\n>> \e[0;33m$1\e[0;00m\n\n"
LOG_INFO = @printf "\n>> \e[0;34m$1\e[0;00m\n\n"
LOG_SUCCESS = @printf "\n>> \e[0;36m$1\e[0;00m\n\n"
LOG_SUBLINE = @printf " \e[0;34m$1\e[0;00m\n\n"
help:
@perl -nle'print $& if m{^[a-zA-Z_-]+:.*?## .*$$}' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-10s\033[0m %s\n", $$1, $$2}'
up: ## Vagrant: start stack
$(call LOG_INFO,Up vagrant stack)
vagrant up --no-destroy-on-error --no-tty --provider=libvirt
stop: ## Vagrant: stop stack
$(call LOG_INFO,Stop vagrant stack)
vagrant halt --force
destroy: ## Vagrant: destroy stack
$(call LOG_INFO,Destroy vagrant stack)
vagrant destroy --force
ps: ## Vagrant: list machines
$(call LOG_INFO,List vagrant stack)
vagrant status
server: ## Vagrant: connect to server1
$(call LOG_INFO,Connect to server1 via ssh)
vagrant ssh server1