terraform-libvirt/Makefile

48 lines
1.5 KiB
Makefile

.PHONY: console dhcp-lease ssh
console:
@virsh console --domain db1
ssh:
IP=$(shell virsh domifaddr --domain db1 | tail -2 | awk -F ' ' '{ print $$4 }' | sed 's|/.*||') && \
ssh -o ProxyCommand="ssh -W %h:%p antoine@dx30_remote.localdomain" -i ~/.ssh/pri/id_rsa_bis antoine@"$$IP"
dhcp-lease:
@virsh net-dhcp-leases --network private
get-ip:
@virsh domifaddr --domain db1
destroy_vm:
@cd stack && terraform destroy --auto-approve -target=libvirt_domain.db1
destroy_all:
@cd stack && terraform destroy --auto-approve
create_all:
@cd stack && terraform apply --auto-approve
hazelcast:
cd applications/ && \
echo "create python venv workspace" && \
python3 -m venv workspace && \
source workspace/bin/activate && \
echo "install python venv and dependencies" && \
pip install --upgrade pip && \
pip install -r requirements.txt && \
echo "install ansible-galaxy dependencies" && \
ansible-galaxy install -r hazelcast/requirements.yml && \
echo "start playbook" && \
ansible-playbook -i stack_address.toml hazelcast/playbook.yml
stack_init:
cd stack && \
terraform init \
-backend-config="cacert_path=$$HOME/virtualization/kubernetes-the-hard-way/certs/ca.pem" \
-backend-config="cert_path=$$HOME/virtualization/kubernetes-the-hard-way/certs/kubernetes.pem" \
-backend-config="key_path=$$HOME/virtualization/kubernetes-the-hard-way/certs/kubernetes-key.pem"
stack_test:
cd applications/ && \
ansible -m debug -i stack_address.toml all -a "msg=test"