Compare commits
No commits in common. "d2fc0ae6907094e8bb37dfb665851b4d78a6dd4f" and "65b2f3cd08a54affec3c26a3ac6bd992f0fcac21" have entirely different histories.
d2fc0ae690
...
65b2f3cd08
8 changed files with 10 additions and 193 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -42,5 +42,3 @@ terraform.rc
|
||||||
## Kubernetes
|
## Kubernetes
|
||||||
/kubernetes/cluster/apps/staging
|
/kubernetes/cluster/apps/staging
|
||||||
|
|
||||||
## Packer
|
|
||||||
credentials.pkr.hcl
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
version: '3.9'
|
version: '3.9'
|
||||||
services:
|
services:
|
||||||
sabnzbd:
|
sabnzbd:
|
||||||
image: ghcr.io/linuxserver/sabnzbd@sha256:dda700370ad4281d8ffda4fbdad8ac3f720a2829936eafc794fca652095ed4be
|
image: ghcr.io/linuxserver/sabnzbd@sha256:d6a2a967d47b495c5342bc23de76d35eeb2f3ceb53c7be51885ad25f95dffe9b
|
||||||
container_name: sabnzbd
|
container_name: sabnzbd
|
||||||
environment:
|
environment:
|
||||||
- PUID=1000
|
- PUID=1000
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
datasource_list: [ConfigDrive, NoCloud]
|
|
|
@ -1,116 +0,0 @@
|
||||||
packer {
|
|
||||||
required_plugins {
|
|
||||||
name = {
|
|
||||||
version = "~> 1"
|
|
||||||
source = "github.com/hashicorp/proxmox"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
variable "proxmox_api_url" {
|
|
||||||
type = string
|
|
||||||
}
|
|
||||||
|
|
||||||
variable "proxmox_api_token_id" {
|
|
||||||
type = string
|
|
||||||
}
|
|
||||||
|
|
||||||
variable "proxmox_api_token_secret" {
|
|
||||||
type = string
|
|
||||||
sensitive = true
|
|
||||||
}
|
|
||||||
|
|
||||||
# Resource Definiation for the VM Template
|
|
||||||
source "proxmox-clone" "ubuntu-server-jammy" {
|
|
||||||
|
|
||||||
# Proxmox Connection Settings
|
|
||||||
proxmox_url = "${var.proxmox_api_url}"
|
|
||||||
username = "${var.proxmox_api_token_id}"
|
|
||||||
token = "${var.proxmox_api_token_secret}"
|
|
||||||
insecure_skip_tls_verify = true
|
|
||||||
|
|
||||||
# VM General Settings
|
|
||||||
node = "pve2"
|
|
||||||
clone_vm_id = "8101"
|
|
||||||
vm_id = "9636"
|
|
||||||
vm_name = "ubuntu-server-jammy"
|
|
||||||
template_description = "Ubuntu Server jammy Image"
|
|
||||||
|
|
||||||
# VM System Settings
|
|
||||||
qemu_agent = true
|
|
||||||
|
|
||||||
# VM Hard Disk Settings
|
|
||||||
scsi_controller = "virtio-scsi-pci"
|
|
||||||
|
|
||||||
disks {
|
|
||||||
disk_size = "5G"
|
|
||||||
format = "raw"
|
|
||||||
storage_pool = "Fast500Gb"
|
|
||||||
type = "virtio"
|
|
||||||
}
|
|
||||||
|
|
||||||
# VM CPU Settings
|
|
||||||
cores = "2"
|
|
||||||
cpu_type = "x86-64-v2-AES"
|
|
||||||
|
|
||||||
# VM Memory Settings
|
|
||||||
memory = "2048"
|
|
||||||
|
|
||||||
# VM Network Settings
|
|
||||||
network_adapters {
|
|
||||||
model = "virtio"
|
|
||||||
bridge = "vmbr0"
|
|
||||||
firewall = "false"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ssh_username = "mafyuh"
|
|
||||||
ssh_private_key_file = "~/.ssh/id_rsa"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
build {
|
|
||||||
|
|
||||||
name = "ubuntu-server-jammy"
|
|
||||||
sources = ["source.proxmox-clone.ubuntu-server-jammy"]
|
|
||||||
|
|
||||||
|
|
||||||
provisioner "shell" {
|
|
||||||
inline = [
|
|
||||||
"while [ ! -f /var/lib/cloud/instance/boot-finished ]; do echo 'Waiting for cloud-init...'; sleep 1; done",
|
|
||||||
"sudo rm /etc/ssh/ssh_host_*",
|
|
||||||
"sudo truncate -s 0 /etc/machine-id",
|
|
||||||
"sudo apt -y autoremove --purge",
|
|
||||||
"sudo apt -y clean",
|
|
||||||
"sudo apt -y autoclean",
|
|
||||||
"sudo cloud-init clean",
|
|
||||||
"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" ]
|
|
||||||
}
|
|
||||||
|
|
||||||
# Provisioning the VM Template with Docker Installation #4
|
|
||||||
provisioner "shell" {
|
|
||||||
inline = [
|
|
||||||
"sudo apt-get install -y ca-certificates curl gnupg lsb-release nfs-common qemu-guest-agent net-tools",
|
|
||||||
"curl -fsSL https://get.docker.com | sudo sh",
|
|
||||||
"echo \"alias dcu='docker compose up -d'\" >> ~/.bashrc",
|
|
||||||
"echo \"alias dcd='docker compose down'\" >> ~/.bashrc",
|
|
||||||
"git config --global user.name \"Mafyuh\"",
|
|
||||||
"git config --global user.email \"matt@mafyuh.com\"",
|
|
||||||
"sudo apt-get -y update"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1 +0,0 @@
|
||||||
datasource_list: [ConfigDrive, NoCloud]
|
|
|
@ -2,10 +2,6 @@ data "local_file" "ssh_public_key" {
|
||||||
filename = "/home/mafyuh/.ssh/main_key.pub"
|
filename = "/home/mafyuh/.ssh/main_key.pub"
|
||||||
}
|
}
|
||||||
|
|
||||||
data "local_file" "ssh_public_key_2" {
|
|
||||||
filename = "/home/mafyuh/.ssh/id_rsa.pub"
|
|
||||||
}
|
|
||||||
|
|
||||||
resource "proxmox_virtual_environment_file" "cloud_config" {
|
resource "proxmox_virtual_environment_file" "cloud_config" {
|
||||||
content_type = "snippets"
|
content_type = "snippets"
|
||||||
datastore_id = "Slow4tb"
|
datastore_id = "Slow4tb"
|
||||||
|
@ -23,7 +19,6 @@ resource "proxmox_virtual_environment_file" "cloud_config" {
|
||||||
shell: /bin/bash
|
shell: /bin/bash
|
||||||
ssh_authorized_keys:
|
ssh_authorized_keys:
|
||||||
- ${trimspace(data.local_file.ssh_public_key.content)}
|
- ${trimspace(data.local_file.ssh_public_key.content)}
|
||||||
- ${trimspace(data.local_file.ssh_public_key_2.content)}
|
|
||||||
sudo: ALL=(ALL) NOPASSWD:ALL
|
sudo: ALL=(ALL) NOPASSWD:ALL
|
||||||
runcmd:
|
runcmd:
|
||||||
- apt update
|
- apt update
|
||||||
|
@ -35,6 +30,8 @@ resource "proxmox_virtual_environment_file" "cloud_config" {
|
||||||
- su - mafyuh -c 'git clone https://git.mafyuh.dev/mafyuh/iac.git /home/mafyuh/iac'
|
- 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.name "Mafyuh"'
|
||||||
- su - mafyuh -c 'git config --global user.email "matt@mafyuh.com"'
|
- su - mafyuh -c 'git config --global user.email "matt@mafyuh.com"'
|
||||||
|
- su - mafyuh -c 'echo "alias dcu=\'docker compose up -d\'" >> /home/mafyuh/.bashrc
|
||||||
|
- su - mafyuh -c 'echo "alias dcd=\'docker compose down\'" >> /home/mafyuh/.bashrc
|
||||||
- echo "done" > /tmp/cloud-config.done
|
- echo "done" > /tmp/cloud-config.done
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
@ -59,16 +56,19 @@ resource "proxmox_virtual_environment_file" "cloud_config2" {
|
||||||
shell: /bin/bash
|
shell: /bin/bash
|
||||||
ssh_authorized_keys:
|
ssh_authorized_keys:
|
||||||
- ${trimspace(data.local_file.ssh_public_key.content)}
|
- ${trimspace(data.local_file.ssh_public_key.content)}
|
||||||
- ${trimspace(data.local_file.ssh_public_key_2.content)}
|
|
||||||
sudo: ALL=(ALL) NOPASSWD:ALL
|
sudo: ALL=(ALL) NOPASSWD:ALL
|
||||||
runcmd:
|
runcmd:
|
||||||
- apt update
|
- apt update
|
||||||
- apt install -y qemu-guest-agent
|
- apt install -y qemu-guest-agent net-tools nfs-common
|
||||||
- timedatectl set-timezone America/New_York
|
- timedatectl set-timezone America/New_York
|
||||||
- systemctl enable qemu-guest-agent
|
- systemctl enable qemu-guest-agent
|
||||||
- systemctl start qemu-guest-agent
|
- systemctl start qemu-guest-agent
|
||||||
- apt upgrade -y
|
- 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 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"'
|
||||||
|
- su - mafyuh -c 'echo "alias dcu=\'docker compose up -d\'" >> /home/mafyuh/.bashrc
|
||||||
|
- su - mafyuh -c 'echo "alias dcd=\'docker compose down\'" >> /home/mafyuh/.bashrc
|
||||||
- echo "done" > /tmp/cloud-config.done
|
- echo "done" > /tmp/cloud-config.done
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ resource "proxmox_virtual_environment_vm" "Kasm" {
|
||||||
vm_id = 333
|
vm_id = 333
|
||||||
name = "Kasm"
|
name = "Kasm"
|
||||||
description = "kasm"
|
description = "kasm"
|
||||||
tags = ["tofu", "ubuntu-22", "iac-repo"]
|
tags = ["tofu", "ubuntu-22", "auto-homelab-repo"]
|
||||||
started = true
|
started = true
|
||||||
|
|
||||||
agent {
|
agent {
|
||||||
|
|
|
@ -1,63 +0,0 @@
|
||||||
resource "proxmox_virtual_environment_vm" "test" {
|
|
||||||
|
|
||||||
# VM General Settings
|
|
||||||
node_name = "pve2"
|
|
||||||
vm_id = 335
|
|
||||||
name = "test"
|
|
||||||
description = "test"
|
|
||||||
tags = ["tofu", "ubuntu-22", "iac-repo"]
|
|
||||||
started = true
|
|
||||||
|
|
||||||
agent {
|
|
||||||
enabled = true
|
|
||||||
}
|
|
||||||
|
|
||||||
clone {
|
|
||||||
vm_id = 9636
|
|
||||||
}
|
|
||||||
|
|
||||||
# VM CPU Settings
|
|
||||||
cpu {
|
|
||||||
cores = 4
|
|
||||||
type = "host"
|
|
||||||
architecture = "x86_64"
|
|
||||||
}
|
|
||||||
|
|
||||||
# VM Memory Settings
|
|
||||||
memory {
|
|
||||||
dedicated = 4096
|
|
||||||
}
|
|
||||||
|
|
||||||
# VM Network Settings
|
|
||||||
network_device {
|
|
||||||
bridge = "vmbr0"
|
|
||||||
vlan_id = 1
|
|
||||||
}
|
|
||||||
|
|
||||||
# VM Disk Settings
|
|
||||||
disk {
|
|
||||||
datastore_id = "Fast500Gb"
|
|
||||||
size = 10
|
|
||||||
interface = "scsi0"
|
|
||||||
}
|
|
||||||
|
|
||||||
initialization {
|
|
||||||
ip_config {
|
|
||||||
ipv4 {
|
|
||||||
address = "dhcp"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
user_data_file_id = proxmox_virtual_environment_file.cloud_config2.id
|
|
||||||
}
|
|
||||||
|
|
||||||
lifecycle {
|
|
||||||
ignore_changes = [
|
|
||||||
initialization[0].user_account[0].keys,
|
|
||||||
initialization[0].user_account[0].password,
|
|
||||||
initialization[0].user_account[0].username,
|
|
||||||
initialization[0].user_data_file_id
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in a new issue