# PVE Cluster Ansible Management

.PHONY: ping test-connection full-test install-deps diagnose pve-status ssh-debug copy-keys report

# Simple ping test
ping:
	ansible all -m ping

# Test basic connection
test-connection:
	ansible-playbook test-connection.yml

# Full ping pong test
full-test:
	ansible-playbook ping-test.yml

# PVE cluster diagnosis
diagnose:
	ansible-playbook pve-cluster-diagnosis.yml

# SSH debug and fix
ssh-debug:
	ansible-playbook ssh-debug-fix.yml

# Copy SSH keys
copy-keys:
	ansible-playbook copy-ssh-keys.yml

# PVE status check
pve-status:
	ansible pve_cluster -m shell -a "pvecm status"
	ansible pve_cluster -m shell -a "pvecm nodes"

# Show debug report
report:
	@echo "=== PVE Debug Report ==="
	@cat pve-debug-report.md

# Install required packages
install-deps:
	ansible-playbook -i inventory/hosts.yml install-deps.yml

# Check inventory
check-inventory:
	ansible-inventory --list

# Show all hosts
list-hosts:
	ansible all --list-hosts

# Get facts from all hosts
facts:
	ansible all -m setup

# Quick cluster health check
health-check:
	@echo "=== PVE Cluster Health Check ==="
	ansible pve_cluster -m shell -a "pvecm status | head -10"
	ansible pve_cluster -m shell -a "systemctl is-active pve-cluster pveproxy pvedaemon"

# Network connectivity test
network-test:
	ansible-playbook ping-test.yml

# All tests
all-tests: ping full-test diagnose pve-status