Skip to content

Commit 5df6030

Browse files
committedNov 8, 2024
improve packer template
1 parent 5d30cf4 commit 5df6030

File tree

6 files changed

+52
-21
lines changed

6 files changed

+52
-21
lines changed
 

‎docker/actual/docker-compose.yml

-11
This file was deleted.

‎packer/ubuntu-noble/files/daemon.json

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"log-driver": "loki",
3+
"log-opts": {
4+
"loki-url": "http://ubu.lan:3100/loki/api/v1/push",
5+
"loki-batch-size": "400"
6+
}
7+
}

‎packer/ubuntu-noble/ubuntu-noble.pkr.hcl

+15-4
Original file line numberDiff line numberDiff line change
@@ -105,17 +105,28 @@ build {
105105
inline = [ "sudo cp /tmp/pve.cfg /etc/cloud/cloud.cfg.d/pve.cfg" ]
106106
}
107107

108+
provisioner "file" {
109+
source = "files/daemon.json"
110+
destination = "/tmp/daemon.json"
111+
}
112+
108113

109114
provisioner "shell" {
110115
inline = [
111116
# Install packages and add repositories
112-
"sudo add-apt-repository -y ppa:zhangsongcui3371/fastfetch",
117+
"wget https://github.com/fastfetch-cli/fastfetch/releases/download/2.29.0/fastfetch-linux-amd64.deb",
118+
"sudo dpkg -i fastfetch-linux-amd64.deb",
119+
"rm -f fastfetch-linux-amd64.deb",
113120
"sudo apt-get update",
114-
"sudo apt-get install -y ca-certificates curl gnupg lsb-release nfs-common net-tools zsh fastfetch fzf",
121+
"sudo apt-get install -y ca-certificates curl gnupg lsb-release nfs-common net-tools zsh fzf",
115122
# Change default shell to zsh
116123
"sudo chsh -s $(which zsh) mafyuh",
117-
# Install Docker
124+
# Install Docker & Loki Plugin
118125
"curl -fsSL https://get.docker.com | sudo sh",
126+
"sudo docker plugin install grafana/loki-docker-driver:latest --alias loki --grant-all-permissions",
127+
"sudo mv /tmp/daemon.json /etc/docker/daemon.json",
128+
# Set DNS
129+
"sudo mkdir -p /etc/systemd/resolved.conf.d && echo '[Resolve]\nDNS=10.0.0.40' | sudo tee /etc/systemd/resolved.conf.d/dns_servers.conf",
119130
# Install Oh My Zsh and plugins
120131
"sh -c \"$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)\" --unattended",
121132
"git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting",
@@ -132,7 +143,7 @@ build {
132143
# Setup Git
133144
"git config --global user.name \"Mafyuh\"",
134145
"git config --global user.email \"matt@mafyuh.com\"",
135-
"sudo apt-get -y update"
146+
"sudo apt-get -y upgrade"
136147
]
137148
}
138149

‎packer/ubuntu-noble/ubuntu-noble2.pkr.hcl

+16-4
Original file line numberDiff line numberDiff line change
@@ -106,16 +106,28 @@ build {
106106
}
107107

108108

109+
provisioner "file" {
110+
source = "files/daemon.json"
111+
destination = "/tmp/daemon.json"
112+
}
113+
114+
109115
provisioner "shell" {
110116
inline = [
111117
# Install packages and add repositories
112-
"sudo add-apt-repository -y ppa:zhangsongcui3371/fastfetch",
118+
"wget https://github.com/fastfetch-cli/fastfetch/releases/download/2.29.0/fastfetch-linux-amd64.deb",
119+
"sudo dpkg -i fastfetch-linux-amd64.deb",
120+
"rm -f fastfetch-linux-amd64.deb",
113121
"sudo apt-get update",
114-
"sudo apt-get install -y ca-certificates curl gnupg lsb-release nfs-common net-tools zsh fastfetch fzf",
122+
"sudo apt-get install -y ca-certificates curl gnupg lsb-release nfs-common net-tools zsh fzf",
115123
# Change default shell to zsh
116124
"sudo chsh -s $(which zsh) mafyuh",
117-
# Install Docker
125+
# Install Docker & Loki Plugin
118126
"curl -fsSL https://get.docker.com | sudo sh",
127+
"sudo docker plugin install grafana/loki-docker-driver:latest --alias loki --grant-all-permissions",
128+
"sudo mv /tmp/daemon.json /etc/docker/daemon.json",
129+
# Set DNS
130+
"sudo mkdir -p /etc/systemd/resolved.conf.d && echo '[Resolve]\nDNS=10.0.0.40' | sudo tee /etc/systemd/resolved.conf.d/dns_servers.conf",
119131
# Install Oh My Zsh and plugins
120132
"sh -c \"$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)\" --unattended",
121133
"git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting",
@@ -132,7 +144,7 @@ build {
132144
# Setup Git
133145
"git config --global user.name \"Mafyuh\"",
134146
"git config --global user.email \"matt@mafyuh.com\"",
135-
"sudo apt-get -y update"
147+
"sudo apt-get -y upgrade"
136148
]
137149
}
138150

‎terraform/proxmox/cloud-init.tf

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ resource "proxmox_virtual_environment_file" "cloud_config" {
1616
- name: mafyuh
1717
groups:
1818
- sudo
19-
- docker
2019
shell: /bin/bash
2120
ssh_authorized_keys:
2221
- ${trimspace(local.ssh_public_key_1)}
@@ -25,6 +24,7 @@ resource "proxmox_virtual_environment_file" "cloud_config" {
2524
runcmd:
2625
- apt update
2726
- apt upgrade -y
27+
- usermod -aG docker mafyuh
2828
- timedatectl set-timezone America/New_York
2929
- su - mafyuh -c 'git clone https://git.mafyuh.dev/mafyuh/iac.git /home/mafyuh/iac'
3030
- echo "done" > /tmp/cloud-config.done
@@ -47,7 +47,6 @@ resource "proxmox_virtual_environment_file" "cloud_config2" {
4747
- name: mafyuh
4848
groups:
4949
- sudo
50-
- docker
5150
shell: /bin/bash
5251
ssh_authorized_keys:
5352
- ${trimspace(local.ssh_public_key_1)}
@@ -56,6 +55,7 @@ resource "proxmox_virtual_environment_file" "cloud_config2" {
5655
runcmd:
5756
- apt update
5857
- apt upgrade -y
58+
- usermod -aG docker mafyuh
5959
- timedatectl set-timezone America/New_York
6060
- su - mafyuh -c 'git clone https://git.mafyuh.dev/mafyuh/iac.git /home/mafyuh/iac'
6161
- echo "done" > /tmp/cloud-config.done

‎terraform/variables.tf

+12
Original file line numberDiff line numberDiff line change
@@ -91,3 +91,15 @@ variable "ssh_password" {
9191
type = string
9292
sensitive = true
9393
}
94+
95+
variable "grafana_auth" {
96+
description = "Service Account token"
97+
type = string
98+
sensitive = true
99+
}
100+
101+
variable "grafana_url" {
102+
description = "Grafana Url"
103+
type = string
104+
sensitive = true
105+
}

0 commit comments

Comments
 (0)
Please sign in to comment.