-
Notifications
You must be signed in to change notification settings - Fork 0
/
user-data.yaml
92 lines (92 loc) · 3.41 KB
/
user-data.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#cloud-config
hostname: virtual-bradley
fqdn: virtual-bradley
disable_root: false
network:
config: disabled
users:
- name: max
groups: users, admin, docker, sudo
sudo: ALL=(ALL) NOPASSWD:ALL
shell: /bin/bash
lock_passwd: false
ssh_import_id:
- gh:cloudymax
package_update: true
package_upgrade: true
packages:
- wireguard
- openresolv
- ssh-import-id
- sudo
- curl
- tmux
- netplan.io
- apt-transport-https
- ca-certificates
- software-properties-common
- htop
- iotop
- git-extras
- rsyslog
- fail2ban
- gpg
- open-iscsi
- nfs-common
- ncdu
- nvtop
- linux-headers-generic
- gcc
- kmod
- make
- pkg-config
- libvulkan1
runcmd:
######################
# Install YQ
- wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O /usr/bin/yq &&\
- chmod +x /usr/bin/yq
######################
# Install Docker
- sudo chown -R friend:friend /home/friend
- curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
- echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
- sudo apt-get update
- sudo apt-get install -y docker-ce
########################
# Install Docker Compose
- sudo -u friend -i mkdir -p /home/friend/.docker/cli-plugins/
- sudo -u friend -i curl -SL https://github.com/docker/compose/releases/download/v2.17.3/docker-compose-linux-x86_64 -o /home/friend/.docker/cli-plugins/docker-compose
- sudo chmod +x /home/friend/.docker/cli-plugins/docker-compose
########################
# Brew and Python3
- wget https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh
- chmod +x /install.sh
- chmod 777 /install.sh
- sudo -u friend NONINTERACTIVE=1 /bin/bash /install.sh
- sudo -u friend /home/linuxbrew/.linuxbrew/bin/brew shellenv >> /home/friend/.profile
- sudo -u friend /home/linuxbrew/.linuxbrew/opt/[email protected]/libexec/bin >> /home/friend/.profile
- sudo -u friend /home/linuxbrew/.linuxbrew/bin/brew install [email protected] k9s neovim helm
- sudo -u friend /home/linuxbrew/.linuxbrew/bin/pip3.11 install smol-k8s-lab onboardme
- sudo mkdir -p /home/friend/.config/smol-ka8s-lab
- sudo chown -R friend:friend /home/linuxbrew
- sudo chown -R friend:friend /home/friend
#######################
# Prometheus
- wget -O /opt/node_exporter-1.6.1.linux-amd64.tar.gz https://github.com/prometheus/node_exporter/releases/download/v1.6.1/node_exporter-1.6.1.linux-amd64.tar.gz
- tar -xvf /opt/node_exporter-1.6.1.linux-amd64.tar.gz -C /opt
- rm /opt/node_exporter-1.6.1.linux-amd64.tar.gz
- ln -s node_exporter-1.6.1.linux-amd64 /opt/node_exporter
- wget https://raw.githubusercontent.com/small-hack/smol-metal/main/node-exporter.service
- sudo mv node-exporter.service /etc/systemd/system/node-exporter.service
########################
# Start system services
- systemctl daemon-reload
- systemctl enable node-exporter
- systemctl restart node-exporter
- sudo systemctl enable fail2ban
- sudo systemctl start fail2ban
########################
# Nvidia driver
- wget curl https://raw.githubusercontent.com/GoogleCloudPlatform/compute-gpu-installation/main/linux/install_gpu_driver.py -O install_gpu_driver.py
- python3 install_gpu_driver.py