# Linux Operations Automation Makefile .PHONY: help test run demo patch harden decommission lvm-check up down status logs validate clean lint scale-up-web scale-up-db scale-down-web scale-down-db fail-network fail-disk fail-service fail-node scenario-scaling help-scaling help-failure help: ## Show this help message @echo "Linux Operations Automation" @echo "" @echo "Available commands:" @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " %-18s %s\n", $$1, $$2}' test: ## Run offline validation checks ansible-playbook -i inventory/hosts.ini --syntax-check playbooks/*.yml ansible-lint run: ## Run provisioning against the configured inventory ansible-playbook -i inventory/hosts.ini playbooks/provision.yml demo: ## Run a safe local demonstration without requiring live SSH hosts SIMULATION_MODE=true bash ./scripts/simulate_failure.sh service 5 web patch: ## Apply patching workflow against the configured inventory ansible-playbook -i inventory/hosts.ini playbooks/patch.yml harden: ## Apply hardening workflow against the configured inventory ansible-playbook -i inventory/hosts.ini playbooks/hardening.yml decommission: ## Run decommissioning workflow against the configured inventory ansible-playbook -i inventory/hosts.ini playbooks/decommission.yml lvm-check: ## Validate the AAP-style LVM resize workflow ansible-playbook -i inventory/hosts.ini --syntax-check playbooks/lvm_resize.yml up: ## Start the optional local container scaffold docker compose up -d down: ## Stop the optional local container scaffold docker compose down status: ## Show local scaffold status and inventory hosts docker compose ps ansible -i inventory/hosts.ini --list-hosts all || echo "Inventory check failed" logs: ## Show local scaffold logs docker compose logs -f --tail=100 validate: ## Run all offline validation checks $(MAKE) test docker compose config --quiet clean: ## Clean up generated local logs and reports rm -f logs/*.log reports/*.txt lint: ## Lint Ansible content ansible-lint scale-up-web: ## Scale up web servers in simulation mode (usage: make scale-up-web COUNT=2) SIMULATION_MODE=true bash ./scripts/simulate_scaling.sh up $(or $(COUNT),1) web scale-up-db: ## Scale up database servers in simulation mode (usage: make scale-up-db COUNT=1) SIMULATION_MODE=true bash ./scripts/simulate_scaling.sh up $(or $(COUNT),1) db scale-down-web: ## Scale down web servers in simulation mode (usage: make scale-down-web COUNT=1) SIMULATION_MODE=true bash ./scripts/simulate_scaling.sh down $(or $(COUNT),1) web scale-down-db: ## Scale down database servers in simulation mode (usage: make scale-down-db COUNT=1) SIMULATION_MODE=true bash ./scripts/simulate_scaling.sh down $(or $(COUNT),1) db fail-network: ## Simulate network failure safely (usage: make fail-network DURATION=60) SIMULATION_MODE=true bash ./scripts/simulate_failure.sh network $(or $(DURATION),60) fail-disk: ## Simulate disk pressure safely (usage: make fail-disk DURATION=120) SIMULATION_MODE=true bash ./scripts/simulate_failure.sh disk $(or $(DURATION),120) fail-service: ## Simulate service failures safely (usage: make fail-service DURATION=30) SIMULATION_MODE=true bash ./scripts/simulate_failure.sh service $(or $(DURATION),30) fail-node: ## Simulate node failure safely (usage: make fail-node DURATION=300) SIMULATION_MODE=true bash ./scripts/simulate_failure.sh node $(or $(DURATION),300) scenario-scaling: ## Run scaling event syntax validation ansible-playbook -i inventory/hosts.ini --syntax-check scenarios/scaling_event.yml help-scaling: ## Show scaling-related commands @echo "Scaling Commands:" @echo " make scale-up-web COUNT=2" @echo " make scale-up-db COUNT=1" @echo " make scale-down-web COUNT=1" @echo " make scale-down-db COUNT=1" help-failure: ## Show failure simulation commands @echo "Failure Simulation Commands:" @echo " make fail-network DURATION=60" @echo " make fail-disk DURATION=120" @echo " make fail-service DURATION=30" @echo " make fail-node DURATION=300"