Move simler example to a new repository
This commit is contained in:
@@ -1,18 +0,0 @@
|
|||||||
#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
|
|
||||||
users:
|
|
||||||
- name: ubuntu
|
|
||||||
sudo: ALL=(ALL) NOPASSWD:ALL
|
|
||||||
groups: users, admin
|
|
||||||
home: /home/ubuntu
|
|
||||||
shell: /bin/bash
|
|
||||||
lock_passwd: false
|
|
||||||
@@ -1,71 +0,0 @@
|
|||||||
terraform {
|
|
||||||
required_version = ">= 0.13"
|
|
||||||
required_providers {
|
|
||||||
libvirt = {
|
|
||||||
source = "dmacvicar/libvirt"
|
|
||||||
version = "0.8.3"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
provider "libvirt" {
|
|
||||||
uri = "qemu:///system"
|
|
||||||
}
|
|
||||||
|
|
||||||
resource "libvirt_pool" "ubuntu-bios" {
|
|
||||||
name = "ubuntu-bios"
|
|
||||||
type = "dir"
|
|
||||||
target {
|
|
||||||
path = "/tmp/ubuntu-bios"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
resource "libvirt_volume" "ubuntu-bios" {
|
|
||||||
name = "ubuntu-bios-${count.index}"
|
|
||||||
pool = libvirt_pool.ubuntu-bios.name
|
|
||||||
source = "/var/lib/libvirt/images/noble-server-cloudimg-amd64.img"
|
|
||||||
format = "qcow2"
|
|
||||||
count = 1
|
|
||||||
}
|
|
||||||
|
|
||||||
resource "libvirt_cloudinit_disk" "commoninit" {
|
|
||||||
name = "commoninit.iso"
|
|
||||||
user_data = templatefile("${path.module}/cloud_init.yaml", {})
|
|
||||||
}
|
|
||||||
|
|
||||||
resource "libvirt_domain" "domain" {
|
|
||||||
count = 1
|
|
||||||
name = "ubuntu-cloud-server-2404-${count.index}"
|
|
||||||
memory = "4092"
|
|
||||||
vcpu = 2
|
|
||||||
cloudinit = libvirt_cloudinit_disk.commoninit.id
|
|
||||||
|
|
||||||
cpu {
|
|
||||||
mode = "host-model"
|
|
||||||
}
|
|
||||||
|
|
||||||
disk {
|
|
||||||
volume_id = element(libvirt_volume.ubuntu-bios.*.id, count.index)
|
|
||||||
}
|
|
||||||
|
|
||||||
console {
|
|
||||||
type = "pty"
|
|
||||||
target_port = "0"
|
|
||||||
target_type = "virtio"
|
|
||||||
}
|
|
||||||
|
|
||||||
video {
|
|
||||||
type = "virtio"
|
|
||||||
}
|
|
||||||
|
|
||||||
tpm {
|
|
||||||
backend_type = "emulator"
|
|
||||||
backend_version = "2.0"
|
|
||||||
}
|
|
||||||
|
|
||||||
network_interface {
|
|
||||||
network_name = "default"
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user