terraform-libvirt/Makefile

48 lines
1.5 KiB
Makefile
Raw Normal View History

2020-08-10 23:43:24 +00:00
.PHONY: console dhcp-lease ssh
console:
@virsh console --domain db1
ssh:
2021-01-23 20:45:22 +00:00
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"
2020-08-10 23:43:24 +00:00
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
2021-01-31 12:18:57 +00:00
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"