Skip to content

Commit 4530601

Browse files
committedNov 2, 2024
fix up things
1 parent 79f8c58 commit 4530601

File tree

10 files changed

+85
-136
lines changed

10 files changed

+85
-136
lines changed
 

‎packer/ubuntu-jammy/files/pve.cfg

Lines changed: 0 additions & 1 deletion
This file was deleted.

‎packer/ubuntu-jammy/files/.zshrc renamed to ‎packer/ubuntu-noble/files/.zshrc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ plugins=(git ubuntu copypath copyfile dirhistory zsh-interactive-cd docker docke
1010

1111
source $ZSH/oh-my-zsh.sh
1212

13-
# Set up Oh My Posh
14-
eval "$(oh-my-posh init zsh --config https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/sonicboom_dark.omp.json)"
13+
# Set up Oh My Posh Theme
14+
eval "$(oh-my-posh init zsh --config /home/mafyuh/.oh-my-posh/themes/sonicboom_dark.omp.json)"
1515

1616
# Custom aliases
1717
alias dcd="docker compose down"
1818
alias dcu="docker compose up -d"
1919

2020
# Display system information
21-
neofetch
21+
fastfetch

‎packer/ubuntu-jammy/ubuntu-jammy.pkr.hcl renamed to ‎packer/ubuntu-noble/ubuntu-noble.pkr.hcl

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ variable "proxmox_api_token_secret" {
2121
}
2222

2323
# Resource Definiation for the VM Template
24-
source "proxmox-clone" "ubuntu-server-jammy" {
24+
source "proxmox-clone" "ubuntu-server-noble" {
2525

2626
# Proxmox Connection Settings
2727
proxmox_url = "${var.proxmox_api_url}"
@@ -32,12 +32,12 @@ source "proxmox-clone" "ubuntu-server-jammy" {
3232
# VM General Settings
3333
node = "pve2"
3434

35-
## See https://git.mafyuh.dev/mafyuh/iac/src/branch/main/terraform/ubuntu22-template2.tf
36-
clone_vm_id = "8101"
35+
36+
clone_vm_id = "8102"
3737

38-
vm_id = "9999"
39-
vm_name = "ubuntu-server-jammy"
40-
template_description = "Custom Ubuntu Server see https://git.mafyuh.dev/mafyuh/iac/src/branch/main/packer/ubuntu-jammy/ubuntu-jammy.pkr.hcl"
38+
vm_id = "9997"
39+
vm_name = "ubuntu-noble-template"
40+
template_description = "Ubuntu Server Noble"
4141

4242
# VM System Settings
4343
qemu_agent = true
@@ -46,7 +46,7 @@ source "proxmox-clone" "ubuntu-server-jammy" {
4646
scsi_controller = "virtio-scsi-pci"
4747

4848
disks {
49-
disk_size = "4G"
49+
disk_size = "5G"
5050
format = "raw"
5151
storage_pool = "Fast500Gb"
5252
type = "virtio"
@@ -75,8 +75,8 @@ source "proxmox-clone" "ubuntu-server-jammy" {
7575

7676
build {
7777

78-
name = "ubuntu-server-jammy"
79-
sources = ["source.proxmox-clone.ubuntu-server-jammy"]
78+
name = "ubuntu-server-noble"
79+
sources = ["source.proxmox-clone.ubuntu-server-noble"]
8080

8181
## Cleanup for re-template
8282
provisioner "shell" {
@@ -88,6 +88,8 @@ build {
8888
"sudo apt -y clean",
8989
"sudo apt -y autoclean",
9090
"sudo cloud-init clean",
91+
"sudo rm -f /var/lib/dbus/machine-id",
92+
"sudo rm -f /var/lib/systemd/random-seed",
9193
"sudo rm -f /etc/cloud/cloud.cfg.d/subiquity-disable-cloudinit-networking.cfg",
9294
"sudo rm -f /etc/netplan/00-installer-config.yaml",
9395
"sudo sync"
@@ -103,20 +105,31 @@ build {
103105
inline = [ "sudo cp /tmp/pve.cfg /etc/cloud/cloud.cfg.d/pve.cfg" ]
104106
}
105107

106-
# Install commonly used things - add alias's - set git config
108+
107109
provisioner "shell" {
108110
inline = [
109-
"sudo apt-get install -y ca-certificates curl gnupg lsb-release nfs-common qemu-guest-agent net-tools zsh neofetch fzf",
111+
# Install packages and add repositories
112+
"sudo add-apt-repository -y ppa:zhangsongcui3371/fastfetch",
113+
"sudo apt-get update",
114+
"sudo apt-get install -y ca-certificates curl gnupg lsb-release nfs-common net-tools zsh fastfetch fzf",
115+
# Change default shell to zsh
110116
"sudo chsh -s $(which zsh) mafyuh",
117+
# Install Docker
111118
"curl -fsSL https://get.docker.com | sudo sh",
119+
# Install Oh My Zsh and plugins
112120
"sh -c \"$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)\" --unattended",
113121
"git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting",
114122
"git clone https://github.com/zsh-users/zsh-autosuggestions.git $${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-autosuggestions",
115123
"git clone https://github.com/zsh-users/zsh-history-substring-search.git $${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-history-substring-search",
116124
"git clone https://github.com/MichaelAquilina/zsh-you-should-use.git $${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/you-should-use",
125+
# Install Oh My Posh
117126
"mkdir -p /home/mafyuh/.local/bin",
118127
"curl -fsSL https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest/download/posh-linux-amd64 -o /home/mafyuh/.local/bin/oh-my-posh",
119128
"sudo chmod +x /home/mafyuh/.local/bin/oh-my-posh",
129+
# Download posh theme locally
130+
"mkdir -p /home/mafyuh/.oh-my-posh/themes",
131+
"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",
132+
# Setup Git
120133
"git config --global user.name \"Mafyuh\"",
121134
"git config --global user.email \"matt@mafyuh.com\"",
122135
"sudo apt-get -y update"

‎packer/ubuntu-jammy/ubuntu-jammy2.pkr.hcl renamed to ‎packer/ubuntu-noble/ubuntu-noble2.pkr.hcl

Lines changed: 40 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ variable "proxmox_api_token_secret" {
2121
}
2222

2323
# Resource Definiation for the VM Template
24-
source "proxmox-clone" "ubuntu-server-jammy2" {
24+
source "proxmox-clone" "ubuntu-server-noble2" {
2525

2626
# Proxmox Connection Settings
2727
proxmox_url = "${var.proxmox_api_url}"
@@ -32,11 +32,12 @@ source "proxmox-clone" "ubuntu-server-jammy2" {
3232
# VM General Settings
3333
node = "prox"
3434

35-
clone_vm_id = "8100"
35+
36+
clone_vm_id = "8103"
3637

37-
vm_id = "9998"
38-
vm_name = "ubuntu-server-jammy2"
39-
template_description = "Custom Ubuntu Server see https://git.mafyuh.dev/mafyuh/iac/src/branch/main/packer/ubuntu-jammy/ubuntu-jammy2.pkr.hcl"
38+
vm_id = "9996"
39+
vm_name = "ubuntu-noble-template"
40+
template_description = "Ubuntu Server Noble"
4041

4142
# VM System Settings
4243
qemu_agent = true
@@ -45,7 +46,7 @@ source "proxmox-clone" "ubuntu-server-jammy2" {
4546
scsi_controller = "virtio-scsi-pci"
4647

4748
disks {
48-
disk_size = "4G"
49+
disk_size = "5G"
4950
format = "raw"
5051
storage_pool = "Fast2Tb"
5152
type = "virtio"
@@ -74,8 +75,8 @@ source "proxmox-clone" "ubuntu-server-jammy2" {
7475

7576
build {
7677

77-
name = "ubuntu-server-jammy2"
78-
sources = ["source.proxmox-clone.ubuntu-server-jammy2"]
78+
name = "ubuntu-server-noble"
79+
sources = ["source.proxmox-clone.ubuntu-server-noble2"]
7980

8081
## Cleanup for re-template
8182
provisioner "shell" {
@@ -87,33 +88,57 @@ build {
8788
"sudo apt -y clean",
8889
"sudo apt -y autoclean",
8990
"sudo cloud-init clean",
91+
"sudo rm -f /var/lib/dbus/machine-id",
92+
"sudo rm -f /var/lib/systemd/random-seed",
9093
"sudo rm -f /etc/cloud/cloud.cfg.d/subiquity-disable-cloudinit-networking.cfg",
9194
"sudo rm -f /etc/netplan/00-installer-config.yaml",
9295
"sudo sync"
9396
]
9497
}
9598

96-
9799
provisioner "file" {
98100
source = "files/pve.cfg"
99101
destination = "/tmp/pve.cfg"
100102
}
101103

102-
103104
provisioner "shell" {
104105
inline = [ "sudo cp /tmp/pve.cfg /etc/cloud/cloud.cfg.d/pve.cfg" ]
105106
}
106107

107-
# Install Commonly Used Things - add alias's - set git config
108+
108109
provisioner "shell" {
109110
inline = [
110-
"sudo apt-get install -y ca-certificates curl gnupg lsb-release nfs-common qemu-guest-agent net-tools",
111+
# Install packages and add repositories
112+
"sudo add-apt-repository -y ppa:zhangsongcui3371/fastfetch",
113+
"sudo apt-get update",
114+
"sudo apt-get install -y ca-certificates curl gnupg lsb-release nfs-common net-tools zsh fastfetch fzf",
115+
# Change default shell to zsh
116+
"sudo chsh -s $(which zsh) mafyuh",
117+
# Install Docker
111118
"curl -fsSL https://get.docker.com | sudo sh",
112-
"echo \"alias dcu='docker compose up -d'\" >> ~/.bashrc",
113-
"echo \"alias dcd='docker compose down'\" >> ~/.bashrc",
119+
# Install Oh My Zsh and plugins
120+
"sh -c \"$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)\" --unattended",
121+
"git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting",
122+
"git clone https://github.com/zsh-users/zsh-autosuggestions.git $${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-autosuggestions",
123+
"git clone https://github.com/zsh-users/zsh-history-substring-search.git $${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-history-substring-search",
124+
"git clone https://github.com/MichaelAquilina/zsh-you-should-use.git $${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/you-should-use",
125+
# Install Oh My Posh
126+
"mkdir -p /home/mafyuh/.local/bin",
127+
"curl -fsSL https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest/download/posh-linux-amd64 -o /home/mafyuh/.local/bin/oh-my-posh",
128+
"sudo chmod +x /home/mafyuh/.local/bin/oh-my-posh",
129+
# Download posh theme locally
130+
"mkdir -p /home/mafyuh/.oh-my-posh/themes",
131+
"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",
132+
# Setup Git
114133
"git config --global user.name \"Mafyuh\"",
115134
"git config --global user.email \"matt@mafyuh.com\"",
116135
"sudo apt-get -y update"
117136
]
118137
}
119-
}
138+
139+
provisioner "file" {
140+
source = "files/.zshrc"
141+
destination = "~/.zshrc"
142+
}
143+
144+
}

‎terraform/adguard.tf

Lines changed: 0 additions & 64 deletions
This file was deleted.

‎terraform/cloud-init.tf

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,9 @@ resource "proxmox_virtual_environment_file" "cloud_config" {
2424
sudo: ALL=(ALL) NOPASSWD:ALL
2525
runcmd:
2626
- apt update
27-
- apt install -y qemu-guest-agent net-tools nfs-common
27+
- apt upgrade -y
2828
- timedatectl set-timezone America/New_York
29-
- systemctl enable qemu-guest-agent
30-
- systemctl start qemu-guest-agent
31-
- curl -fsSL https://get.docker.com | sudo sh
3229
- su - mafyuh -c 'git clone https://git.mafyuh.dev/mafyuh/iac.git /home/mafyuh/iac'
33-
- su - mafyuh -c 'git config --global user.name "Mafyuh"'
34-
- su - mafyuh -c 'git config --global user.email "matt@mafyuh.com"'
3530
- echo "done" > /tmp/cloud-config.done
3631
EOF
3732

@@ -60,10 +55,8 @@ resource "proxmox_virtual_environment_file" "cloud_config2" {
6055
sudo: ALL=(ALL) NOPASSWD:ALL
6156
runcmd:
6257
- apt update
63-
- timedatectl set-timezone America/New_York
64-
- systemctl enable qemu-guest-agent
65-
- systemctl start qemu-guest-agent
6658
- apt upgrade -y
59+
- timedatectl set-timezone America/New_York
6760
- su - mafyuh -c 'git clone https://git.mafyuh.dev/mafyuh/iac.git /home/mafyuh/iac'
6861
- echo "done" > /tmp/cloud-config.done
6962
EOF

‎terraform/secrets.tfvars

Lines changed: 0 additions & 15 deletions
This file was deleted.

‎terraform/ubuntu22-template2.tf renamed to ‎terraform/ubuntu-noble-base.tf

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
1-
resource "proxmox_virtual_environment_vm" "Ubuntu-22-Template2" {
2-
name = "ubuntu-22"
1+
resource "proxmox_virtual_environment_vm" "Ubuntu-Noble-Base" {
2+
name = "ubuntu-noble-base"
33
node_name = "pve2"
4-
vm_id = 8101
5-
tags = ["tofu", "ubuntu-22"]
4+
vm_id = 8102
5+
tags = ["tofu", "ubuntu24"]
66
template = true
77
started = false
88

99
disk {
1010
datastore_id = "local-lvm"
11-
file_id = "local:iso/jammy-server-cloudimg-amd64.img"
11+
# See https://www.reddit.com/r/Proxmox/comments/1058ko7/comment/j3s4vli/ for how to inject qemu into base image
12+
# virt-customize -a noble-server-cloudimg-amd64.img --install qemu-guest-agent
13+
file_id = "local:iso/noble-server-cloudimg-amd64.img"
1214
interface = "scsi0"
13-
size = 4
15+
size = 5
1416
}
1517

1618
agent {
@@ -23,8 +25,6 @@ resource "proxmox_virtual_environment_vm" "Ubuntu-22-Template2" {
2325
address = "dhcp"
2426
}
2527
}
26-
27-
user_data_file_id = proxmox_virtual_environment_file.cloud_config2.id
2828
}
2929

3030
serial_device {}

‎terraform/ubuntu22-template.tf renamed to ‎terraform/ubuntu-noble-base2.tf

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
1-
resource "proxmox_virtual_environment_vm" "Ubuntu-22-Template" {
2-
name = "ubuntu-22"
1+
resource "proxmox_virtual_environment_vm" "Ubuntu-Noble-Base2" {
2+
name = "ubuntu-noble-base"
33
node_name = "prox"
4-
vm_id = 8100
5-
tags = ["tofu", "ubuntu-22"]
4+
vm_id = 8103
5+
tags = ["tofu", "ubuntu24"]
66
template = true
77
started = false
88

99
disk {
1010
datastore_id = "Fast2Tb"
11-
file_id = "local:iso/jammy-server-cloudimg-amd64.img"
11+
# See https://www.reddit.com/r/Proxmox/comments/1058ko7/comment/j3s4vli/ for how to inject qemu into base image
12+
# virt-customize -a noble-server-cloudimg-amd64.img --install qemu-guest-agent
13+
file_id = "local:iso/noble-server-cloudimg-amd64.img"
1214
interface = "scsi0"
13-
size = 4
15+
size = 5
1416
}
1517

1618
agent {
@@ -23,8 +25,6 @@ resource "proxmox_virtual_environment_vm" "Ubuntu-22-Template" {
2325
address = "dhcp"
2426
}
2527
}
26-
27-
user_data_file_id = proxmox_virtual_environment_file.cloud_config.id
2828
}
2929

3030
serial_device {}
@@ -43,5 +43,3 @@ cpu {
4343
architecture = "x86_64"
4444
}
4545
}
46-
47-
File renamed without changes.

0 commit comments

Comments
 (0)
Please sign in to comment.