adding cloud init plus windows
This commit is contained in:
parent
7a1ad932bf
commit
d80cce8bfb
3 changed files with 80 additions and 1 deletions
|
@ -27,6 +27,42 @@ resource "proxmox_virtual_environment_file" "cloud_config" {
|
|||
- systemctl enable qemu-guest-agent
|
||||
- systemctl start qemu-guest-agent
|
||||
- curl -fsSL https://get.docker.com | sudo sh
|
||||
- su - mafyuh -c 'git clone https://git.mafyuh.dev/mafyuh/IaC-Homelab.git /home/mafyuh/IaC-Homelab'
|
||||
- su - mafyuh -c 'git clone https://git.mafyuh.dev/mafyuh/Auto-Homelab.git /home/mafyuh/Auto-Homelab'
|
||||
- echo "done" > /tmp/cloud-config.done
|
||||
EOF
|
||||
|
||||
file_name = "cloud-config.yaml"
|
||||
}
|
||||
}
|
||||
|
||||
resource "proxmox_virtual_environment_file" "cloud_config2" {
|
||||
content_type = "snippets"
|
||||
datastore_id = "Fast500Gb"
|
||||
node_name = "pve2"
|
||||
|
||||
source_raw {
|
||||
data = <<-EOF
|
||||
#cloud-config
|
||||
users:
|
||||
- default
|
||||
- name: mafyuh
|
||||
groups:
|
||||
- sudo
|
||||
- docker
|
||||
shell: /bin/bash
|
||||
ssh_authorized_keys:
|
||||
- ${trimspace(data.local_file.ssh_public_key.content)}
|
||||
sudo: ALL=(ALL) NOPASSWD:ALL
|
||||
runcmd:
|
||||
- apt update
|
||||
- apt install -y qemu-guest-agent net-tools nfs-common
|
||||
- timedatectl set-timezone America/New_York
|
||||
- systemctl enable qemu-guest-agent
|
||||
- systemctl start qemu-guest-agent
|
||||
- curl -fsSL https://get.docker.com | sudo sh
|
||||
- su - mafyuh -c 'git clone https://git.mafyuh.dev/mafyuh/IaC-Homelab.git /home/mafyuh/IaC-Homelab'
|
||||
- su - mafyuh -c 'git clone https://git.mafyuh.dev/mafyuh/Auto-Homelab.git /home/mafyuh/Auto-Homelab'
|
||||
- echo "done" > /tmp/cloud-config.done
|
||||
EOF
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ resource "proxmox_virtual_environment_vm" "Ubuntu-22-Template2" {
|
|||
}
|
||||
}
|
||||
|
||||
user_data_file_id = proxmox_virtual_environment_file.cloud_config.id
|
||||
user_data_file_id = proxmox_virtual_environment_file.cloud_config2.id
|
||||
}
|
||||
|
||||
serial_device {}
|
||||
|
|
43
windows.tf
Normal file
43
windows.tf
Normal file
|
@ -0,0 +1,43 @@
|
|||
resource "proxmox_virtual_environment_vm" "Windows11" {
|
||||
name = "windows"
|
||||
node_name = "pve2"
|
||||
vm_id = 250
|
||||
tags = ["tofu"]
|
||||
started = false
|
||||
bios = "ovmf"
|
||||
machine = "q35"
|
||||
|
||||
disk {
|
||||
datastore_id = "Fast500Gb"
|
||||
interface = "scsi0"
|
||||
size = 450
|
||||
}
|
||||
|
||||
cpu {
|
||||
cores = 2
|
||||
type = "host"
|
||||
architecture = "x86_64"
|
||||
}
|
||||
|
||||
memory {
|
||||
dedicated = 8192
|
||||
}
|
||||
|
||||
efi_disk {
|
||||
type = "4m"
|
||||
}
|
||||
|
||||
network_device {
|
||||
bridge = "vmbr0"
|
||||
vlan_id = 1
|
||||
}
|
||||
|
||||
tpm_state {
|
||||
datastore_id = "Fast500Gb"
|
||||
version = "v2.0"
|
||||
}
|
||||
|
||||
operating_system {
|
||||
type = "win11"
|
||||
}
|
||||
}
|
Reference in a new issue