feat: use macvtap to make VM accessible to CI machine
This commit is contained in:
parent
0306798bad
commit
bf87080e33
5 changed files with 27 additions and 9 deletions
|
@ -1,4 +1,5 @@
|
||||||
libvirt_uri = "qemu+ssh://mcaptcha-ci@192.168.0.102/system?keyfile=/tmp/ci-ssh-id&sshauth=privkey&no_verify=1"
|
libvirt_uri = "qemu+ssh://mcaptcha-ci@192.168.0.102/system?keyfile=/tmp/ci-ssh-id&sshauth=privkey&no_verify=1"
|
||||||
#known_hosts_verify=ignore&keyfile=/tmp/ssh-key&sshauth=privkey&no_verify=1"
|
|
||||||
libvirt_pool_path = "/home/mcaptcha-ci/libvirt/pool/mcaptcha_basic"
|
libvirt_pool_path = "/home/mcaptcha-ci/libvirt/pool/mcaptcha_basic"
|
||||||
libvirt_debian_src = "http://192.168.0.102/debian-12-generic-amd64.qcow2"
|
libvirt_debian_src = "http://192.168.0.102/debian-12-generic-amd64.qcow2"
|
||||||
|
macvtap_ethernet_interface = "enp2s0"
|
||||||
|
ssh_public_key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBCYagT9/PXoeaUae7Z3BKOPKBiEvJsCTUIhPCcRp5fb mcaptcha-ci@hellbat.batsense.net"
|
||||||
|
|
|
@ -16,6 +16,7 @@ resource "libvirt_domain" "mcaptcha_mcaptcha" {
|
||||||
name = "mcaptcha_mcaptcha_${count.index}"
|
name = "mcaptcha_mcaptcha_${count.index}"
|
||||||
memory = var.mcaptcha_vm_memory
|
memory = var.mcaptcha_vm_memory
|
||||||
vcpu = var.mcaptcha_vm_vcpu
|
vcpu = var.mcaptcha_vm_vcpu
|
||||||
|
qemu_agent = true
|
||||||
|
|
||||||
cloudinit = libvirt_cloudinit_disk.commoninit.id
|
cloudinit = libvirt_cloudinit_disk.commoninit.id
|
||||||
|
|
||||||
|
@ -31,8 +32,9 @@ resource "libvirt_domain" "mcaptcha_mcaptcha" {
|
||||||
target_port = "1"
|
target_port = "1"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
network_interface {
|
network_interface {
|
||||||
network_name = "default"
|
macvtap = var.macvtap_ethernet_interface
|
||||||
wait_for_lease = true
|
wait_for_lease = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,6 +43,8 @@ resource "libvirt_domain" "mcaptcha_mcaptcha" {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
locals {
|
locals {
|
||||||
mcaptcha_vm_ips = [for i in libvirt_domain.mcaptcha_mcaptcha : i.network_interface.0.addresses[0]]
|
mcaptcha_vm_ips = [for i in libvirt_domain.mcaptcha_mcaptcha : i.network_interface.0.addresses[0]]
|
||||||
mcaptcha_vm_names = [for i in libvirt_domain.mcaptcha_mcaptcha : i.name]
|
mcaptcha_vm_names = [for i in libvirt_domain.mcaptcha_mcaptcha : i.name]
|
||||||
|
|
|
@ -2,3 +2,4 @@ version: 2
|
||||||
ethernets:
|
ethernets:
|
||||||
ens3:
|
ens3:
|
||||||
dhcp4: true
|
dhcp4: true
|
||||||
|
# ip: 192.168.0.115
|
||||||
|
|
|
@ -44,3 +44,15 @@ variable "mcaptcha_vm_vcpu" {
|
||||||
type = number
|
type = number
|
||||||
default = 4
|
default = 4
|
||||||
}
|
}
|
||||||
|
|
||||||
|
variable "macvtap_ethernet_interface" {
|
||||||
|
description = "Ethernet interface on the host machine that can be used as macvtap"
|
||||||
|
type = string
|
||||||
|
default = "enp2s0"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "ssh_public_key" {
|
||||||
|
description = "Set up SSH login for this public key"
|
||||||
|
type = string
|
||||||
|
default = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC/wXdHpwpY/4ubhYTmuNdGepQpj1kchvTUTApxMZyfyVW4uzrPRTYsle1y9QbTBV35qLkNajRC/wmC5/xPchdXpsJpuD9st1HMhLeR8qwaPyptiYJYT+z/WisWw2k6oWhG3QKvPoRtBdW9nhZnkG+O6zkuGXiRHpS7j2VVboDPpWEe1UdELQFVCwfraRal2g3ENFZ/9V1UrW/4ahRnQnSxERplZUm/fgSxQtmXubTkW68ut7yasBsrKFffMm8JztW0tWgTlTKONd3LCjv4juM0t5+cJDotNDnUR86Tq2PG8io7no/h8BWtazmjdpfGgn02ibX26BkdU0LDEYbJt5q9/Fh9TGk2ZwcMQeyepO1AWQgkmHXZWZELqu6MLQpqdtsOjHp9k0MeSpuIbdwzgf10Ydy7vK1z8irS24tVNNnJaMBwOlVOPwfyztHRADPkFcv2lKSjS1uyKR0FIkV8Kvs4txaIjmwv2LfMg6lF5W6j3ZPLyeE4cplJP0DDjzorSanu31xVnqVb3A8V9awsJ/4H7d59bI99c7QHL4K3fBVP3O0gqd31xAVRsdGs5Tj2P+RpiI6o5JJiOa1+DuBdWzrVIXYchQ30ZjaJp1wTNsYLmAsjeYuQZE2tf1xvywdzD4MB4avugDEWikzRWN9V5PHDZr1bamTCCjOrb2PRCd7eSQ== aravinth7820@gmail.com"
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue