This commit is contained in:
parent
79f8c58127
commit
4530601f15
10 changed files with 85 additions and 136 deletions
|
@ -1 +0,0 @@
|
|||
datasource_list: [ConfigDrive, NoCloud]
|
|
@ -10,12 +10,12 @@ plugins=(git ubuntu copypath copyfile dirhistory zsh-interactive-cd docker docke
|
|||
|
||||
source $ZSH/oh-my-zsh.sh
|
||||
|
||||
# Set up Oh My Posh
|
||||
eval "$(oh-my-posh init zsh --config https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/sonicboom_dark.omp.json)"
|
||||
# Set up Oh My Posh Theme
|
||||
eval "$(oh-my-posh init zsh --config /home/mafyuh/.oh-my-posh/themes/sonicboom_dark.omp.json)"
|
||||
|
||||
# Custom aliases
|
||||
alias dcd="docker compose down"
|
||||
alias dcu="docker compose up -d"
|
||||
|
||||
# Display system information
|
||||
neofetch
|
||||
fastfetch
|
|
@ -21,7 +21,7 @@ variable "proxmox_api_token_secret" {
|
|||
}
|
||||
|
||||
# Resource Definiation for the VM Template
|
||||
source "proxmox-clone" "ubuntu-server-jammy" {
|
||||
source "proxmox-clone" "ubuntu-server-noble" {
|
||||
|
||||
# Proxmox Connection Settings
|
||||
proxmox_url = "${var.proxmox_api_url}"
|
||||
|
@ -32,12 +32,12 @@ source "proxmox-clone" "ubuntu-server-jammy" {
|
|||
# VM General Settings
|
||||
node = "pve2"
|
||||
|
||||
## See https://git.mafyuh.dev/mafyuh/iac/src/branch/main/terraform/ubuntu22-template2.tf
|
||||
clone_vm_id = "8101"
|
||||
|
||||
vm_id = "9999"
|
||||
vm_name = "ubuntu-server-jammy"
|
||||
template_description = "Custom Ubuntu Server see https://git.mafyuh.dev/mafyuh/iac/src/branch/main/packer/ubuntu-jammy/ubuntu-jammy.pkr.hcl"
|
||||
clone_vm_id = "8102"
|
||||
|
||||
vm_id = "9997"
|
||||
vm_name = "ubuntu-noble-template"
|
||||
template_description = "Ubuntu Server Noble"
|
||||
|
||||
# VM System Settings
|
||||
qemu_agent = true
|
||||
|
@ -46,7 +46,7 @@ source "proxmox-clone" "ubuntu-server-jammy" {
|
|||
scsi_controller = "virtio-scsi-pci"
|
||||
|
||||
disks {
|
||||
disk_size = "4G"
|
||||
disk_size = "5G"
|
||||
format = "raw"
|
||||
storage_pool = "Fast500Gb"
|
||||
type = "virtio"
|
||||
|
@ -75,8 +75,8 @@ source "proxmox-clone" "ubuntu-server-jammy" {
|
|||
|
||||
build {
|
||||
|
||||
name = "ubuntu-server-jammy"
|
||||
sources = ["source.proxmox-clone.ubuntu-server-jammy"]
|
||||
name = "ubuntu-server-noble"
|
||||
sources = ["source.proxmox-clone.ubuntu-server-noble"]
|
||||
|
||||
## Cleanup for re-template
|
||||
provisioner "shell" {
|
||||
|
@ -88,6 +88,8 @@ build {
|
|||
"sudo apt -y clean",
|
||||
"sudo apt -y autoclean",
|
||||
"sudo cloud-init clean",
|
||||
"sudo rm -f /var/lib/dbus/machine-id",
|
||||
"sudo rm -f /var/lib/systemd/random-seed",
|
||||
"sudo rm -f /etc/cloud/cloud.cfg.d/subiquity-disable-cloudinit-networking.cfg",
|
||||
"sudo rm -f /etc/netplan/00-installer-config.yaml",
|
||||
"sudo sync"
|
||||
|
@ -103,20 +105,31 @@ build {
|
|||
inline = [ "sudo cp /tmp/pve.cfg /etc/cloud/cloud.cfg.d/pve.cfg" ]
|
||||
}
|
||||
|
||||
# Install commonly used things - add alias's - set git config
|
||||
|
||||
provisioner "shell" {
|
||||
inline = [
|
||||
"sudo apt-get install -y ca-certificates curl gnupg lsb-release nfs-common qemu-guest-agent net-tools zsh neofetch fzf",
|
||||
# Install packages and add repositories
|
||||
"sudo add-apt-repository -y ppa:zhangsongcui3371/fastfetch",
|
||||
"sudo apt-get update",
|
||||
"sudo apt-get install -y ca-certificates curl gnupg lsb-release nfs-common net-tools zsh fastfetch fzf",
|
||||
# Change default shell to zsh
|
||||
"sudo chsh -s $(which zsh) mafyuh",
|
||||
# Install Docker
|
||||
"curl -fsSL https://get.docker.com | sudo sh",
|
||||
# Install Oh My Zsh and plugins
|
||||
"sh -c \"$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)\" --unattended",
|
||||
"git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting",
|
||||
"git clone https://github.com/zsh-users/zsh-autosuggestions.git $${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-autosuggestions",
|
||||
"git clone https://github.com/zsh-users/zsh-history-substring-search.git $${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-history-substring-search",
|
||||
"git clone https://github.com/MichaelAquilina/zsh-you-should-use.git $${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/you-should-use",
|
||||
# Install Oh My Posh
|
||||
"mkdir -p /home/mafyuh/.local/bin",
|
||||
"curl -fsSL https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest/download/posh-linux-amd64 -o /home/mafyuh/.local/bin/oh-my-posh",
|
||||
"sudo chmod +x /home/mafyuh/.local/bin/oh-my-posh",
|
||||
# Download posh theme locally
|
||||
"mkdir -p /home/mafyuh/.oh-my-posh/themes",
|
||||
"curl -fsSL https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/sonicboom_dark.omp.json -o /home/mafyuh/.oh-my-posh/themes/sonicboom_dark.omp.json",
|
||||
# Setup Git
|
||||
"git config --global user.name \"Mafyuh\"",
|
||||
"git config --global user.email \"matt@mafyuh.com\"",
|
||||
"sudo apt-get -y update"
|
|
@ -21,7 +21,7 @@ variable "proxmox_api_token_secret" {
|
|||
}
|
||||
|
||||
# Resource Definiation for the VM Template
|
||||
source "proxmox-clone" "ubuntu-server-jammy2" {
|
||||
source "proxmox-clone" "ubuntu-server-noble2" {
|
||||
|
||||
# Proxmox Connection Settings
|
||||
proxmox_url = "${var.proxmox_api_url}"
|
||||
|
@ -32,11 +32,12 @@ source "proxmox-clone" "ubuntu-server-jammy2" {
|
|||
# VM General Settings
|
||||
node = "prox"
|
||||
|
||||
clone_vm_id = "8100"
|
||||
|
||||
vm_id = "9998"
|
||||
vm_name = "ubuntu-server-jammy2"
|
||||
template_description = "Custom Ubuntu Server see https://git.mafyuh.dev/mafyuh/iac/src/branch/main/packer/ubuntu-jammy/ubuntu-jammy2.pkr.hcl"
|
||||
clone_vm_id = "8103"
|
||||
|
||||
vm_id = "9996"
|
||||
vm_name = "ubuntu-noble-template"
|
||||
template_description = "Ubuntu Server Noble"
|
||||
|
||||
# VM System Settings
|
||||
qemu_agent = true
|
||||
|
@ -45,7 +46,7 @@ source "proxmox-clone" "ubuntu-server-jammy2" {
|
|||
scsi_controller = "virtio-scsi-pci"
|
||||
|
||||
disks {
|
||||
disk_size = "4G"
|
||||
disk_size = "5G"
|
||||
format = "raw"
|
||||
storage_pool = "Fast2Tb"
|
||||
type = "virtio"
|
||||
|
@ -74,8 +75,8 @@ source "proxmox-clone" "ubuntu-server-jammy2" {
|
|||
|
||||
build {
|
||||
|
||||
name = "ubuntu-server-jammy2"
|
||||
sources = ["source.proxmox-clone.ubuntu-server-jammy2"]
|
||||
name = "ubuntu-server-noble"
|
||||
sources = ["source.proxmox-clone.ubuntu-server-noble2"]
|
||||
|
||||
## Cleanup for re-template
|
||||
provisioner "shell" {
|
||||
|
@ -87,33 +88,57 @@ build {
|
|||
"sudo apt -y clean",
|
||||
"sudo apt -y autoclean",
|
||||
"sudo cloud-init clean",
|
||||
"sudo rm -f /var/lib/dbus/machine-id",
|
||||
"sudo rm -f /var/lib/systemd/random-seed",
|
||||
"sudo rm -f /etc/cloud/cloud.cfg.d/subiquity-disable-cloudinit-networking.cfg",
|
||||
"sudo rm -f /etc/netplan/00-installer-config.yaml",
|
||||
"sudo sync"
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
provisioner "file" {
|
||||
source = "files/pve.cfg"
|
||||
destination = "/tmp/pve.cfg"
|
||||
}
|
||||
|
||||
|
||||
provisioner "shell" {
|
||||
inline = [ "sudo cp /tmp/pve.cfg /etc/cloud/cloud.cfg.d/pve.cfg" ]
|
||||
}
|
||||
|
||||
# Install Commonly Used Things - add alias's - set git config
|
||||
|
||||
provisioner "shell" {
|
||||
inline = [
|
||||
"sudo apt-get install -y ca-certificates curl gnupg lsb-release nfs-common qemu-guest-agent net-tools",
|
||||
# Install packages and add repositories
|
||||
"sudo add-apt-repository -y ppa:zhangsongcui3371/fastfetch",
|
||||
"sudo apt-get update",
|
||||
"sudo apt-get install -y ca-certificates curl gnupg lsb-release nfs-common net-tools zsh fastfetch fzf",
|
||||
# Change default shell to zsh
|
||||
"sudo chsh -s $(which zsh) mafyuh",
|
||||
# Install Docker
|
||||
"curl -fsSL https://get.docker.com | sudo sh",
|
||||
"echo \"alias dcu='docker compose up -d'\" >> ~/.bashrc",
|
||||
"echo \"alias dcd='docker compose down'\" >> ~/.bashrc",
|
||||
# Install Oh My Zsh and plugins
|
||||
"sh -c \"$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)\" --unattended",
|
||||
"git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting",
|
||||
"git clone https://github.com/zsh-users/zsh-autosuggestions.git $${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-autosuggestions",
|
||||
"git clone https://github.com/zsh-users/zsh-history-substring-search.git $${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-history-substring-search",
|
||||
"git clone https://github.com/MichaelAquilina/zsh-you-should-use.git $${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/you-should-use",
|
||||
# Install Oh My Posh
|
||||
"mkdir -p /home/mafyuh/.local/bin",
|
||||
"curl -fsSL https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest/download/posh-linux-amd64 -o /home/mafyuh/.local/bin/oh-my-posh",
|
||||
"sudo chmod +x /home/mafyuh/.local/bin/oh-my-posh",
|
||||
# Download posh theme locally
|
||||
"mkdir -p /home/mafyuh/.oh-my-posh/themes",
|
||||
"curl -fsSL https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/sonicboom_dark.omp.json -o /home/mafyuh/.oh-my-posh/themes/sonicboom_dark.omp.json",
|
||||
# Setup Git
|
||||
"git config --global user.name \"Mafyuh\"",
|
||||
"git config --global user.email \"matt@mafyuh.com\"",
|
||||
"sudo apt-get -y update"
|
||||
]
|
||||
}
|
||||
|
||||
provisioner "file" {
|
||||
source = "files/.zshrc"
|
||||
destination = "~/.zshrc"
|
||||
}
|
||||
|
||||
}
|
|
@ -1,64 +0,0 @@
|
|||
resource "proxmox_virtual_environment_vm" "Adguard" {
|
||||
|
||||
# VM General Settings
|
||||
node_name = "prox"
|
||||
vm_id = 206
|
||||
name = "Adguard"
|
||||
description = "DNS Server"
|
||||
tags = ["tofu", "ubuntu24", "auto-homelab-repo", "infrastructure"]
|
||||
|
||||
agent {
|
||||
enabled = false # read 'Qemu guest agent' section, change to true only when ready
|
||||
}
|
||||
|
||||
clone {
|
||||
vm_id = 8002
|
||||
}
|
||||
|
||||
# VM CPU Settings
|
||||
cpu {
|
||||
cores = 2
|
||||
type = "host"
|
||||
architecture = "x86_64"
|
||||
}
|
||||
|
||||
# VM Memory Settings
|
||||
memory {
|
||||
dedicated = 2048
|
||||
}
|
||||
|
||||
# VM Network Settings
|
||||
network_device {
|
||||
bridge = "vmbr0"
|
||||
}
|
||||
|
||||
# VM Disk Settings
|
||||
disk {
|
||||
datastore_id = "Fast2Tb"
|
||||
size = 60
|
||||
interface = "scsi0"
|
||||
}
|
||||
|
||||
vga {
|
||||
type = "serial0"
|
||||
}
|
||||
|
||||
initialization {
|
||||
ip_config {
|
||||
ipv4 {
|
||||
address = "dhcp"
|
||||
}
|
||||
}
|
||||
|
||||
user_account {}
|
||||
}
|
||||
|
||||
lifecycle {
|
||||
ignore_changes = [
|
||||
initialization[0].user_account[0].keys,
|
||||
initialization[0].user_account[0].password,
|
||||
initialization[0].user_account[0].username,
|
||||
]
|
||||
}
|
||||
|
||||
}
|
|
@ -24,14 +24,9 @@ resource "proxmox_virtual_environment_file" "cloud_config" {
|
|||
sudo: ALL=(ALL) NOPASSWD:ALL
|
||||
runcmd:
|
||||
- apt update
|
||||
- apt install -y qemu-guest-agent net-tools nfs-common
|
||||
- apt upgrade -y
|
||||
- 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.git /home/mafyuh/iac'
|
||||
- su - mafyuh -c 'git config --global user.name "Mafyuh"'
|
||||
- su - mafyuh -c 'git config --global user.email "matt@mafyuh.com"'
|
||||
- echo "done" > /tmp/cloud-config.done
|
||||
EOF
|
||||
|
||||
|
@ -60,10 +55,8 @@ resource "proxmox_virtual_environment_file" "cloud_config2" {
|
|||
sudo: ALL=(ALL) NOPASSWD:ALL
|
||||
runcmd:
|
||||
- apt update
|
||||
- timedatectl set-timezone America/New_York
|
||||
- systemctl enable qemu-guest-agent
|
||||
- systemctl start qemu-guest-agent
|
||||
- apt upgrade -y
|
||||
- timedatectl set-timezone America/New_York
|
||||
- su - mafyuh -c 'git clone https://git.mafyuh.dev/mafyuh/iac.git /home/mafyuh/iac'
|
||||
- echo "done" > /tmp/cloud-config.done
|
||||
EOF
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
arrbuntu_ip_address = ""
|
||||
downloaders_ip_address = ""
|
||||
init_password = ""
|
||||
kasm_ip = ""
|
||||
kasm_ssh_ip = ""
|
||||
npm_ip_address = ""
|
||||
prox_ip_address = ""
|
||||
pve2_ip_address = ""
|
||||
s3_endpoint = ""
|
||||
ssh_password = ""
|
||||
ssh_username = ""
|
||||
ubu_ip_address = ""
|
||||
virtual_environment_api = ""
|
||||
virtual_environment_endpoint = ""
|
||||
vlan_gateway = ""
|
|
@ -1,16 +1,18 @@
|
|||
resource "proxmox_virtual_environment_vm" "Ubuntu-22-Template2" {
|
||||
name = "ubuntu-22"
|
||||
resource "proxmox_virtual_environment_vm" "Ubuntu-Noble-Base" {
|
||||
name = "ubuntu-noble-base"
|
||||
node_name = "pve2"
|
||||
vm_id = 8101
|
||||
tags = ["tofu", "ubuntu-22"]
|
||||
vm_id = 8102
|
||||
tags = ["tofu", "ubuntu24"]
|
||||
template = true
|
||||
started = false
|
||||
|
||||
disk {
|
||||
datastore_id = "local-lvm"
|
||||
file_id = "local:iso/jammy-server-cloudimg-amd64.img"
|
||||
# See https://www.reddit.com/r/Proxmox/comments/1058ko7/comment/j3s4vli/ for how to inject qemu into base image
|
||||
# virt-customize -a noble-server-cloudimg-amd64.img --install qemu-guest-agent
|
||||
file_id = "local:iso/noble-server-cloudimg-amd64.img"
|
||||
interface = "scsi0"
|
||||
size = 4
|
||||
size = 5
|
||||
}
|
||||
|
||||
agent {
|
||||
|
@ -23,8 +25,6 @@ resource "proxmox_virtual_environment_vm" "Ubuntu-22-Template2" {
|
|||
address = "dhcp"
|
||||
}
|
||||
}
|
||||
|
||||
user_data_file_id = proxmox_virtual_environment_file.cloud_config2.id
|
||||
}
|
||||
|
||||
serial_device {}
|
|
@ -1,16 +1,18 @@
|
|||
resource "proxmox_virtual_environment_vm" "Ubuntu-22-Template" {
|
||||
name = "ubuntu-22"
|
||||
resource "proxmox_virtual_environment_vm" "Ubuntu-Noble-Base2" {
|
||||
name = "ubuntu-noble-base"
|
||||
node_name = "prox"
|
||||
vm_id = 8100
|
||||
tags = ["tofu", "ubuntu-22"]
|
||||
vm_id = 8103
|
||||
tags = ["tofu", "ubuntu24"]
|
||||
template = true
|
||||
started = false
|
||||
|
||||
disk {
|
||||
datastore_id = "Fast2Tb"
|
||||
file_id = "local:iso/jammy-server-cloudimg-amd64.img"
|
||||
# See https://www.reddit.com/r/Proxmox/comments/1058ko7/comment/j3s4vli/ for how to inject qemu into base image
|
||||
# virt-customize -a noble-server-cloudimg-amd64.img --install qemu-guest-agent
|
||||
file_id = "local:iso/noble-server-cloudimg-amd64.img"
|
||||
interface = "scsi0"
|
||||
size = 4
|
||||
size = 5
|
||||
}
|
||||
|
||||
agent {
|
||||
|
@ -23,8 +25,6 @@ resource "proxmox_virtual_environment_vm" "Ubuntu-22-Template" {
|
|||
address = "dhcp"
|
||||
}
|
||||
}
|
||||
|
||||
user_data_file_id = proxmox_virtual_environment_file.cloud_config.id
|
||||
}
|
||||
|
||||
serial_device {}
|
||||
|
@ -43,5 +43,3 @@ cpu {
|
|||
architecture = "x86_64"
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Add table
Reference in a new issue