2023-11-10 20:50:45 +00:00
|
|
|
up:
|
|
|
|
@echo "Checking for Homelab installation..."
|
|
|
|
@vagrant status | grep "not created" > /dev/null; \
|
|
|
|
if [ "$$?" -gt 0 ]; then \
|
|
|
|
echo "Installation found, bringing it up..."; \
|
|
|
|
vagrant up; \
|
|
|
|
else \
|
|
|
|
echo "No Homelab installation found or missing components, creating..."; \
|
|
|
|
$(MAKE) install_vb; \
|
|
|
|
fi
|
|
|
|
|
2023-11-10 21:55:41 +00:00
|
|
|
down:
|
|
|
|
@echo "Stopping Homelab..."
|
|
|
|
@vagrant suspend
|
|
|
|
|
2023-10-30 15:54:48 +00:00
|
|
|
install_vb:
|
2023-11-10 20:50:45 +00:00
|
|
|
@echo "Creating components..."
|
|
|
|
@vagrant up
|
|
|
|
@echo "Installing k3s backbone configuration..."
|
|
|
|
@cd ansible && ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook -i ../inventory/lab.yml -i ../inventory/outsider.yml init.yml --extra-vars "enable_setup=true enable_wireguard=true enable_k3s=true"
|
|
|
|
@make get_k3s_credentials
|
2023-10-23 12:26:55 +00:00
|
|
|
|
|
|
|
k3s_reset:
|
2023-11-10 20:50:45 +00:00
|
|
|
@echo "Resetting k3s configuration..."
|
|
|
|
@cd ansible && ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook -i ../inventory/lab.yml -i ../inventory/outsider.yml k3s-ansible/reset.yml
|
|
|
|
@cd ansible && ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook -i ../inventory/lab.yml -i ../inventory/outsider.yml init.yml --extra-vars "enable_setup=true enable_wireguard=true enable_k3s=true"
|
|
|
|
@make get_k3s_credentials
|
2023-10-23 12:26:55 +00:00
|
|
|
|
|
|
|
destroy:
|
2023-11-10 20:50:45 +00:00
|
|
|
@echo "Destroy Homelab installation..."
|
|
|
|
@vagrant destroy -f
|
2023-10-23 12:26:55 +00:00
|
|
|
|
|
|
|
get_k3s_credentials:
|
2023-11-10 20:50:45 +00:00
|
|
|
@echo "Retrieving k3s credentials locally..."
|
|
|
|
@vagrant ssh -c "sudo cat /home/creator/.kube/config" hb-wide-1 > ~/.kube/config-halia
|
|
|
|
@sed -i 's/10.20.*:/192.168.56.101:/g' ~/.kube/config-halia
|
|
|
|
@kube-merge
|
|
|
|
@kubectl get nodes --context halia
|
|
|
|
|