Merge branch 'main' of https://git.mafyuh.dev/mafyuh/iac
This commit is contained in:
commit
1ac336a521
9 changed files with 205 additions and 11 deletions
|
@ -22,7 +22,7 @@ services:
|
||||||
- 5443:5443/udp
|
- 5443:5443/udp
|
||||||
|
|
||||||
adguardhome-sync:
|
adguardhome-sync:
|
||||||
image: ghcr.io/linuxserver/adguardhome-sync@sha256:9469d0e6b3a09ed88a9c3c522de6c905d1aeff673e490e1c9b26e4f76caa0f4c
|
image: ghcr.io/linuxserver/adguardhome-sync@sha256:46a8549d84a56bc8f81f69b38ce1f39d60da4fbcac8b582e3981da39d097bc40
|
||||||
container_name: adguardhome-sync
|
container_name: adguardhome-sync
|
||||||
environment:
|
environment:
|
||||||
- PUID=1000
|
- PUID=1000
|
||||||
|
|
|
@ -109,7 +109,7 @@ services:
|
||||||
networks:
|
networks:
|
||||||
- gitea_main
|
- gitea_main
|
||||||
n8n:
|
n8n:
|
||||||
image: ghcr.io/n8n-io/n8n:1.58.1
|
image: ghcr.io/n8n-io/n8n:1.59.0
|
||||||
container_name: n8n
|
container_name: n8n
|
||||||
ports:
|
ports:
|
||||||
- 5678:5678
|
- 5678:5678
|
||||||
|
@ -139,7 +139,7 @@ services:
|
||||||
ipv4_address: 172.25.0.25
|
ipv4_address: 172.25.0.25
|
||||||
|
|
||||||
syncthing:
|
syncthing:
|
||||||
image: ghcr.io/linuxserver/syncthing@sha256:2339cd2967d886ef16d9ba3c332060330915b53111aa022eba7313a1136f0a4a
|
image: ghcr.io/linuxserver/syncthing@sha256:cd9ec0abcab9eb51a5f1d2fd19cad2d5e84e479e6589d809121614080b37c4f2
|
||||||
container_name: syncthing
|
container_name: syncthing
|
||||||
hostname: ARM #optional
|
hostname: ARM #optional
|
||||||
environment:
|
environment:
|
||||||
|
|
|
@ -15,7 +15,7 @@ services:
|
||||||
- PGID=1000
|
- PGID=1000
|
||||||
|
|
||||||
lidarr:
|
lidarr:
|
||||||
image: ghcr.io/linuxserver/lidarr@sha256:a77af413426b8509fad2d02f5b89104a5766ee6ebb13497d73993e74f6cfa0a8
|
image: ghcr.io/linuxserver/lidarr@sha256:1a543b03bbb76a6683bbbe77e4366917f0e7eae67f2e5e6c005dd40344ec7008
|
||||||
container_name: lidarr
|
container_name: lidarr
|
||||||
ports:
|
ports:
|
||||||
- "8686:8686"
|
- "8686:8686"
|
||||||
|
@ -31,7 +31,7 @@ services:
|
||||||
- PGID=1000
|
- PGID=1000
|
||||||
|
|
||||||
prowlarr:
|
prowlarr:
|
||||||
image: ghcr.io/linuxserver/prowlarr@sha256:9dd32e2270d174b07bd33a1f54e2b79e03ad944df62ed93efa08f4a381adc9a1
|
image: ghcr.io/linuxserver/prowlarr@sha256:c1318191d5211ac7462c754422eafe350ed0de61c4160065a420896068ec1ccc
|
||||||
container_name: prowlarr
|
container_name: prowlarr
|
||||||
ports:
|
ports:
|
||||||
- "9696:9696"
|
- "9696:9696"
|
||||||
|
@ -57,7 +57,7 @@ services:
|
||||||
- PGID=1000
|
- PGID=1000
|
||||||
|
|
||||||
sonarr:
|
sonarr:
|
||||||
image: ghcr.io/linuxserver/sonarr@sha256:138998077a802c18b76c26636301fcd5517b7bfaf75db025d457199176078a12
|
image: ghcr.io/linuxserver/sonarr@sha256:28cc44346fc87805b52a4376a89edc12cf082a5530cffee800a6c05dee482734
|
||||||
container_name: sonarr
|
container_name: sonarr
|
||||||
ports:
|
ports:
|
||||||
- "8989:8989"
|
- "8989:8989"
|
||||||
|
@ -130,7 +130,7 @@ services:
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
||||||
pinchflat:
|
pinchflat:
|
||||||
image: ghcr.io/kieraneglin/pinchflat@sha256:16dca569fa5f890f60d3b04f0cd25d2af7ccd960ad635ae8ba1e514619df189f
|
image: ghcr.io/kieraneglin/pinchflat@sha256:2642214c8e04c5092f4c983ac7fe7804e1acadd5a9677d5101d0bb49c4185f14
|
||||||
environment:
|
environment:
|
||||||
- TZ=America/New_York
|
- TZ=America/New_York
|
||||||
ports:
|
ports:
|
||||||
|
@ -140,7 +140,7 @@ services:
|
||||||
- /data/media/Youtube/downloads:/downloads
|
- /data/media/Youtube/downloads:/downloads
|
||||||
|
|
||||||
syncthing:
|
syncthing:
|
||||||
image: ghcr.io/linuxserver/syncthing@sha256:2339cd2967d886ef16d9ba3c332060330915b53111aa022eba7313a1136f0a4a
|
image: ghcr.io/linuxserver/syncthing@sha256:cd9ec0abcab9eb51a5f1d2fd19cad2d5e84e479e6589d809121614080b37c4f2
|
||||||
container_name: syncthing
|
container_name: syncthing
|
||||||
hostname: ARRS
|
hostname: ARRS
|
||||||
environment:
|
environment:
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
version: '3.9'
|
version: '3.9'
|
||||||
services:
|
services:
|
||||||
sabnzbd:
|
sabnzbd:
|
||||||
image: ghcr.io/linuxserver/sabnzbd@sha256:66576a72ecb80c8d9e8ebffd4699995b29bfff4aefba4c6eae14baac3cbf6716
|
image: ghcr.io/linuxserver/sabnzbd@sha256:cf7743af338e1cdfc97f6e6c605c8c45d737a4f268ab96ba6cec565134cea5e1
|
||||||
container_name: sabnzbd
|
container_name: sabnzbd
|
||||||
environment:
|
environment:
|
||||||
- PUID=1000
|
- PUID=1000
|
||||||
|
|
|
@ -37,7 +37,7 @@ services:
|
||||||
privileged: true
|
privileged: true
|
||||||
|
|
||||||
syncthing:
|
syncthing:
|
||||||
image: ghcr.io/linuxserver/syncthing@sha256:2339cd2967d886ef16d9ba3c332060330915b53111aa022eba7313a1136f0a4a
|
image: ghcr.io/linuxserver/syncthing@sha256:cd9ec0abcab9eb51a5f1d2fd19cad2d5e84e479e6589d809121614080b37c4f2
|
||||||
container_name: syncthing
|
container_name: syncthing
|
||||||
hostname: JF
|
hostname: JF
|
||||||
environment:
|
environment:
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
---
|
---
|
||||||
services:
|
services:
|
||||||
netbootxyz:
|
netbootxyz:
|
||||||
image: ghcr.io/linuxserver/netbootxyz@sha256:18f5faec9e1f4362e6d1d1e7cbde3a2c8d6733dc7c00a9958b3aa88d28e8eb4b
|
image: ghcr.io/linuxserver/netbootxyz@sha256:16fdc41c85cd9fd3057868e539b9300aaf95f9fc29be1b13bf78334802e0b10f
|
||||||
container_name: netboot
|
container_name: netboot
|
||||||
environment:
|
environment:
|
||||||
- PUID=1000
|
- PUID=1000
|
||||||
|
|
119
packer/ubuntu-jammy/ubuntu-jammy2.pkr.hcl
Normal file
119
packer/ubuntu-jammy/ubuntu-jammy2.pkr.hcl
Normal file
|
@ -0,0 +1,119 @@
|
||||||
|
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-jammy2" {
|
||||||
|
|
||||||
|
# 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 = "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"
|
||||||
|
|
||||||
|
# VM System Settings
|
||||||
|
qemu_agent = true
|
||||||
|
|
||||||
|
# VM Hard Disk Settings
|
||||||
|
scsi_controller = "virtio-scsi-pci"
|
||||||
|
|
||||||
|
disks {
|
||||||
|
disk_size = "4G"
|
||||||
|
format = "raw"
|
||||||
|
storage_pool = "Fast2Tb"
|
||||||
|
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"
|
||||||
|
# WSL Filesystem
|
||||||
|
ssh_private_key_file = "~/.ssh/id_rsa"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
build {
|
||||||
|
|
||||||
|
name = "ubuntu-server-jammy2"
|
||||||
|
sources = ["source.proxmox-clone.ubuntu-server-jammy2"]
|
||||||
|
|
||||||
|
## Cleanup for re-template
|
||||||
|
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" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
# 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",
|
||||||
|
"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"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
71
terraform/ubu.tf
Normal file
71
terraform/ubu.tf
Normal file
|
@ -0,0 +1,71 @@
|
||||||
|
resource "proxmox_virtual_environment_vm" "Ubu" {
|
||||||
|
|
||||||
|
# VM General Settings
|
||||||
|
node_name = "prox"
|
||||||
|
vm_id = 5000
|
||||||
|
name = "Ubu"
|
||||||
|
description = "My attempt to move things to 1 VM"
|
||||||
|
tags = ["tofu", "ubuntu-22", "auto-homelab-repo", "infrastructure"]
|
||||||
|
|
||||||
|
agent {
|
||||||
|
enabled = true # read 'Qemu guest agent' section, change to true only when ready
|
||||||
|
}
|
||||||
|
|
||||||
|
clone {
|
||||||
|
vm_id = 9998
|
||||||
|
}
|
||||||
|
|
||||||
|
# VM CPU Settings
|
||||||
|
cpu {
|
||||||
|
cores = 2
|
||||||
|
type = "host"
|
||||||
|
architecture = "x86_64"
|
||||||
|
}
|
||||||
|
|
||||||
|
# VM Memory Settings
|
||||||
|
memory {
|
||||||
|
dedicated = 6144
|
||||||
|
}
|
||||||
|
|
||||||
|
# VM Network Settings
|
||||||
|
network_device {
|
||||||
|
bridge = "vmbr0"
|
||||||
|
vlan_id = 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# VM Disk Settings
|
||||||
|
disk {
|
||||||
|
datastore_id = "Fast2Tb"
|
||||||
|
size = 120
|
||||||
|
interface = "scsi0"
|
||||||
|
}
|
||||||
|
|
||||||
|
vga {
|
||||||
|
type = "serial0"
|
||||||
|
}
|
||||||
|
|
||||||
|
initialization {
|
||||||
|
ip_config {
|
||||||
|
ipv4 {
|
||||||
|
address = var.ubu_ip_address
|
||||||
|
gateway = var.vlan_gateway
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
user_data_file_id = proxmox_virtual_environment_file.cloud_config.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
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
output "vm_ipv4_address" {
|
||||||
|
value = proxmox_virtual_environment_vm.Ubu.ipv4_addresses[1][0]
|
||||||
|
}
|
|
@ -53,3 +53,7 @@ variable "kasm_ip" {
|
||||||
variable "kasm_ssh_ip" {
|
variable "kasm_ssh_ip" {
|
||||||
type = string
|
type = string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
variable "ubu_ip_address" {
|
||||||
|
type = string
|
||||||
|
}
|
Loading…
Reference in a new issue