Initial
This commit is contained in:
117
Makefile
Normal file
117
Makefile
Normal file
@@ -0,0 +1,117 @@
|
||||
# Bare Bones Vagrant Makefile
|
||||
|
||||
.PHONY: help start stop destroy status ssh-host ssh-machine1 ssh-machine2 ssh-machine3 ssh-machine4 clean \
|
||||
ansible-ping ansible-setup ansible-deploy ansible-list ansible-facts \
|
||||
reset-full reset-destroy reset-start reset-test reset-ssh reset-ansible reset-setup reset-deploy
|
||||
|
||||
# Default target
|
||||
help: ## Show this help message
|
||||
@echo "Bare Bones Vagrant Management"
|
||||
@echo "============================"
|
||||
@echo ""
|
||||
@echo "Available targets:"
|
||||
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf " %-15s %s\n", $$1, $$2}' $(MAKEFILE_LIST)
|
||||
|
||||
start: ## Start all machines
|
||||
@echo "Starting all machines..."
|
||||
./manage.sh start
|
||||
|
||||
stop: ## Stop all machines
|
||||
@echo "Stopping all machines..."
|
||||
./manage.sh stop
|
||||
|
||||
destroy: ## Destroy all machines (permanent)
|
||||
@echo "Destroying all machines..."
|
||||
./manage.sh destroy
|
||||
|
||||
status: ## Show machine status
|
||||
@echo "Showing machine status..."
|
||||
./manage.sh status
|
||||
|
||||
ssh-host: ## Access host machine via SSH
|
||||
@echo "Accessing host machine..."
|
||||
./manage.sh ssh host
|
||||
|
||||
ssh-machine1: ## Access machine1 via SSH
|
||||
@echo "Accessing machine1..."
|
||||
./manage.sh ssh machine1
|
||||
|
||||
ssh-machine2: ## Access machine2 via SSH
|
||||
@echo "Accessing machine2..."
|
||||
./manage.sh ssh machine2
|
||||
|
||||
ssh-machine3: ## Access machine3 via SSH
|
||||
@echo "Accessing machine3..."
|
||||
./manage.sh ssh machine3
|
||||
|
||||
ssh-machine4: ## Access machine4 via SSH
|
||||
@echo "Accessing machine4..."
|
||||
./manage.sh ssh machine4
|
||||
|
||||
clean: ## Clean up temporary files
|
||||
@echo "Cleaning up temporary files..."
|
||||
rm -rf backup-* *.log *.tmp *.temp
|
||||
@echo "Cleanup complete!"
|
||||
|
||||
# Quick access targets
|
||||
host: ssh-host ## Alias for ssh-host
|
||||
m1: ssh-machine1 ## Alias for ssh-machine1
|
||||
m2: ssh-machine2 ## Alias for ssh-machine2
|
||||
m3: ssh-machine3 ## Alias for ssh-machine3
|
||||
m4: ssh-machine4 ## Alias for ssh-machine4
|
||||
|
||||
# Ansible targets
|
||||
ansible-ping: ## Test Ansible connectivity to all hosts
|
||||
@echo "Testing Ansible connectivity..."
|
||||
ansible all -i inventory -m ping
|
||||
|
||||
ansible-setup: ## Run setup playbook to install dependencies
|
||||
@echo "Installing Ansible roles..."
|
||||
ansible-galaxy install -r ansible-requirements.yml --force
|
||||
@echo "Running setup playbook..."
|
||||
ansible-playbook -i inventory setup-playbook.yml
|
||||
|
||||
ansible-deploy: ## Run deployment playbook
|
||||
@echo "Running deployment playbook..."
|
||||
ansible-playbook -i inventory deploy-playbook.yml
|
||||
|
||||
ansible-list: ## List all hosts in inventory
|
||||
@echo "Listing all hosts..."
|
||||
ansible all -i inventory --list-hosts
|
||||
|
||||
ansible-facts: ## Gather facts from all hosts
|
||||
@echo "Gathering facts from all hosts..."
|
||||
ansible all -i inventory -m setup
|
||||
|
||||
# Reset and Test targets
|
||||
reset-full: ## Full destroy/recreate/test cycle
|
||||
@echo "Running full reset and test cycle..."
|
||||
./reset-and-test.sh full-reset
|
||||
|
||||
reset-destroy: ## Only destroy all machines
|
||||
@echo "Destroying all machines..."
|
||||
./reset-and-test.sh destroy-only
|
||||
|
||||
reset-start: ## Only start all machines
|
||||
@echo "Starting all machines..."
|
||||
./reset-and-test.sh start-only
|
||||
|
||||
reset-test: ## Only run tests (assumes machines are running)
|
||||
@echo "Running tests..."
|
||||
./reset-and-test.sh test-only
|
||||
|
||||
reset-ssh: ## Only test SSH connectivity
|
||||
@echo "Testing SSH connectivity..."
|
||||
./reset-and-test.sh ssh-test
|
||||
|
||||
reset-ansible: ## Only test Ansible connectivity
|
||||
@echo "Testing Ansible connectivity..."
|
||||
./reset-and-test.sh ansible-test
|
||||
|
||||
reset-setup: ## Only run setup playbook
|
||||
@echo "Running setup playbook..."
|
||||
./reset-and-test.sh setup-only
|
||||
|
||||
reset-deploy: ## Only run deployment playbook
|
||||
@echo "Running deployment playbook..."
|
||||
./reset-and-test.sh deploy-only
|
||||
Reference in New Issue
Block a user