add option to fix MAC address of VM

create atlas VM
This commit is contained in:
Pim Kunis 2023-11-29 18:59:36 +01:00
parent d5d6b0d7cc
commit deb87e4da3
4 changed files with 43 additions and 7 deletions

View file

@ -14,15 +14,20 @@ terraform {
# https://libvirt.org/uri.html#libssh-and-libssh2-transport
provider "libvirt" {
# alias = "jefke"
alias = "jefke"
uri = "qemu+ssh://root@jefke.hyp/system?known_hosts=/etc/ssh/ssh_known_hosts"
}
provider "libvirt" {
alias = "atlas"
uri = "qemu+ssh://root@atlas.hyp/system?known_hosts=/etc/ssh/ssh_known_hosts"
}
module "setup_jefke" {
source = "./modules/setup"
# providers = {
# libvirt = libvirt.jefke
# }
providers = {
libvirt = libvirt.jefke
}
}
module "bancomart" {
@ -30,7 +35,25 @@ module "bancomart" {
name = "bancomart"
ram = 4096
storage = 25
# providers = {
# libvirt = libvirt.jefke
# }
providers = {
libvirt = libvirt.jefke
}
}
module "setup_atlas" {
source = "./modules/setup"
providers = {
libvirt = libvirt.atlas
}
}
module "maestro" {
source = "./modules/debian"
name = "maestro"
ram = 8192
storage = 35
mac = "CA:FE:C0:FF:EE:08"
providers = {
libvirt = libvirt.atlas
}
}

View file

@ -3,6 +3,12 @@ hostname: "${hostname}"
manage_etc_hosts: true
disable_root: false
chpasswd:
list: |
root:root
expire: False
ssh_pwauth: true
ssh_authorized_keys:
- "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOodpLr+FDRyKyHjucHizNLVFHZ5AQmE9GmxMnOsSoaw pimkunis@thinkpadpim"
- "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINUZp4BCxf7uLa1QWonx/Crf8tYZ5MKIZ+EuaBa82LrV user@user-laptop"

View file

@ -42,6 +42,7 @@ resource "libvirt_domain" "main" {
network_interface {
bridge = "bridgedmz"
hostname = var.name
mac = var.mac
}
cloudinit = libvirt_cloudinit_disk.main.id

View file

@ -11,3 +11,9 @@ variable "storage" {
type = number
description = "In GiB"
}
variable "mac" {
type = string
description = "MAC address"
default = null
}