Compare commits
4 Commits
8078d9c041
...
798cc871c8
Author | SHA1 | Date | |
---|---|---|---|
|
798cc871c8 | ||
|
86be10c776 | ||
|
b1b7a6e311 | ||
|
778711fdfb |
@@ -1,18 +1,11 @@
|
||||
#cloud-config
|
||||
# vim: syntax=yaml
|
||||
# examples:
|
||||
# https://cloudinit.readthedocs.io/en/latest/topics/examples.html
|
||||
---
|
||||
ssh_pwauth: true
|
||||
disable_root: false
|
||||
chpasswd:
|
||||
list: |
|
||||
root:password
|
||||
expire: false
|
||||
disable_root: true
|
||||
users:
|
||||
- name: ubuntu
|
||||
- name: groot
|
||||
sudo: ALL=(ALL) NOPASSWD:ALL
|
||||
groups: users, admin
|
||||
home: /home/ubuntu
|
||||
groups: wheel,sudo,adm
|
||||
shell: /bin/bash
|
||||
lock_passwd: false
|
||||
ssh_authorized_keys:
|
||||
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDMSuVlvOsMqx9qOrKKB1295FjCf2QhHfR1qola9brGkUcFL9dAztG2qdQnpiuPQ4OJpkedrO3C/ixEw1MLTL8l12SvYy/Q9QFguwylp35Nbw1p8h7jrX1FcNLRYltxkMgVhCs1InT5m0lf56bu1h7JfsMs7Ovsy3lU5OdK4h2MysTSKOLctsE4jDJ+XbJYQzj4rbfB/U7/9ple366cGl6xlaHxVfI4BUFWUOiVU4HWvZjrOM5fqPt+AUFRx1l2D7hLUZgOdVQwgO8GFn0sCyCIw0NCXbDn/H05pvWtTUPnyhj5TiseF8qW1byrrT5G8saxwvx8nbIK2tpPfKFdIiL7aj9bYQdltn1knJtvk3hpTPy4QvAbaoGfnfrPAsyU1A/CTw9SD/idvDT2wt1hVsm8EsnpovF7WT5z22fcgoFLDo+QCQrp7t1Wx0/Djay2nThi3FO3N051y5fQWoKOvTsm+rRhrzpDoc+Wtrtss3ua54qnQxHRx3YC0M5Xl9DINkwrcunbZBhozsDG2DzX9qcyzJsSfm9Zt5yM2lpcq+dGPRO1wedw4ogoOpobRr9Cja9W/lJvxmjgIiHz2HbSFPtk/VGjL6M7aQor/GDNN3ugSsfUoTTmNaS9+lWeg+tQWcFUPhYQtQB4/gHQ2u7+mQ0H3hVybsIKIh5XBpAdHQ7pww== lukas@home
|
||||
|
||||
ssh_pwauth: false
|
||||
|
@@ -5,11 +5,12 @@ resource "libvirt_domain" "domain" {
|
||||
vcpu = var.vcpu
|
||||
cloudinit = libvirt_cloudinit_disk.commoninit.id
|
||||
cpu {
|
||||
mode = "host-model"
|
||||
mode = "host-passthrough"
|
||||
}
|
||||
|
||||
disk {
|
||||
volume_id = element(libvirt_volume.vm_disk.*.id, count.index)
|
||||
scsi = "true"
|
||||
}
|
||||
|
||||
console {
|
||||
|
@@ -16,4 +16,25 @@ output "cloudinit_disk_id" {
|
||||
|
||||
output "cloudinit_disk_name" {
|
||||
value = libvirt_cloudinit_disk.commoninit.name
|
||||
}
|
||||
}
|
||||
|
||||
# Additional useful outputs for counted resources
|
||||
output "domain_names" {
|
||||
value = [for domain in libvirt_domain.domain : domain.name]
|
||||
}
|
||||
|
||||
output "domain_ids" {
|
||||
value = [for domain in libvirt_domain.domain : domain.id]
|
||||
}
|
||||
|
||||
output "volume_names" {
|
||||
value = [for volume in libvirt_volume.vm_disk : volume.name]
|
||||
}
|
||||
|
||||
output "volume_ids" {
|
||||
value = [for volume in libvirt_volume.vm_disk : volume.id]
|
||||
}
|
||||
|
||||
output "instance_count" {
|
||||
value = var.instance_count
|
||||
}
|
||||
|
@@ -32,22 +32,7 @@ variable "image_location" {
|
||||
type = string
|
||||
default = "https://cloud-images.ubuntu.com/noble/current/noble-server-cloudimg-amd64.img"
|
||||
}
|
||||
# In order to avoid refetching the cloud ISO each time, it could could be set to a local directory, like : "/var/lib/libvirt/images/noble-server-cloudimg-amd64.img"
|
||||
|
||||
# variable "cloudinit_user_data" {
|
||||
# description = "User data for cloud-init"
|
||||
# type = string
|
||||
# default = <<EOF
|
||||
# #cloud-config
|
||||
# hostname: ubuntu-cloud-server
|
||||
# fqdn: ubuntu-cloud-server.tf.local
|
||||
# EOF
|
||||
# }
|
||||
|
||||
# variable "cloud_init_file" {
|
||||
# description = "Name of cloud-init config file"
|
||||
# type = optional(string)
|
||||
# }
|
||||
# To avoid refetching the cloud ISO each time, it could could be set to a local directory, like : "/var/lib/libvirt/images/noble-server-cloudimg-amd64.img"
|
||||
|
||||
variable "cloudinit_filename" {
|
||||
description = "Name of the cloud-init ISO file"
|
||||
@@ -57,7 +42,7 @@ variable "cloudinit_filename" {
|
||||
variable "user_data" {
|
||||
description = "User data for cloud-init"
|
||||
type = string
|
||||
default = "data.template_file.user_data.rendered"
|
||||
default = ""
|
||||
}
|
||||
|
||||
variable "memory" {
|
||||
|
Reference in New Issue
Block a user