fix: Initial ansible setup
This commit is contained in:
121
Makefile
121
Makefile
@@ -1,112 +1,13 @@
|
||||
# Bare Bones Vagrant Makefile
|
||||
list:
|
||||
vagrant status
|
||||
make up:
|
||||
cd vagrant && vagrant up
|
||||
make destroy:
|
||||
cd vagrant && vagrant destroy -f
|
||||
|
||||
.PHONY: help start stop destroy status ssh-manager ssh-worker1 ssh-worker2 ssh-worker3 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
|
||||
make ansible-master:
|
||||
cd ansible && ansible-playbook -i ../vagrant/.vagrant/provisioners/ansible/inventory/vagrant_ansible_inventory master.yml
|
||||
|
||||
# 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-manager: ## Access swarm manager via SSH
|
||||
@echo "Accessing swarm manager..."
|
||||
./manage.sh ssh swarm-manager
|
||||
|
||||
ssh-worker1: ## Access swarm worker1 via SSH
|
||||
@echo "Accessing swarm worker1..."
|
||||
./manage.sh ssh swarm-worker1
|
||||
|
||||
ssh-worker2: ## Access swarm worker2 via SSH
|
||||
@echo "Accessing swarm worker2..."
|
||||
./manage.sh ssh swarm-worker2
|
||||
|
||||
ssh-worker3: ## Access swarm worker3 via SSH
|
||||
@echo "Accessing swarm worker3..."
|
||||
./manage.sh ssh swarm-worker3
|
||||
|
||||
clean: ## Clean up temporary files
|
||||
@echo "Cleaning up temporary files..."
|
||||
rm -rf backup-* *.log *.tmp *.temp
|
||||
@echo "Cleanup complete!"
|
||||
|
||||
# Quick access targets
|
||||
manager: ssh-manager ## Alias for ssh-manager
|
||||
w1: ssh-worker1 ## Alias for ssh-worker1
|
||||
w2: ssh-worker2 ## Alias for ssh-worker2
|
||||
w3: ssh-worker3 ## Alias for ssh-worker3
|
||||
|
||||
# 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 Docker Swarm deployment playbook
|
||||
@echo "Running Docker Swarm 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
|
||||
make setup-keys:
|
||||
mkdir -p ./keys
|
||||
ssh-keygen -t ed25519 -f ./keys/access -N "" -q
|
||||
|
||||
Reference in New Issue
Block a user