feat-test-playbooks #5

Merged
realaravinth merged 19 commits from feat-test-playbooks into master 2023-12-13 00:49:03 +05:30
5 changed files with 27 additions and 9 deletions
Showing only changes of commit bf87080e33 - Show all commits

View file

@ -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"

View file

@ -13,9 +13,10 @@ resource "libvirt_volume" "mcaptcha_volume" {
resource "libvirt_domain" "mcaptcha_mcaptcha" { resource "libvirt_domain" "mcaptcha_mcaptcha" {
count = var.mcaptcha_vm_count count = var.mcaptcha_vm_count
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]

View file

@ -2,3 +2,4 @@ version: 2
ethernets: ethernets:
ens3: ens3:
dhcp4: true dhcp4: true
# ip: 192.168.0.115

View file

@ -12,7 +12,7 @@ resource "local_file" "hosts_yml" {
{ {
mcaptcha_vms_ips = local.mcaptcha_vm_ips, mcaptcha_vms_ips = local.mcaptcha_vm_ips,
mcaptcha_vms_names = local.mcaptcha_vm_names, mcaptcha_vms_names = local.mcaptcha_vm_names,
mcaptcha_vms = local.mcaptcha_vm_map mcaptcha_vms = local.mcaptcha_vm_map
}) })

View file

@ -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"
}