packer: fixing networking

This commit is contained in:
Kyle Isom 2023-04-14 16:34:58 -07:00
parent 10be9bac41
commit f0abff9f6a
10 changed files with 45 additions and 57 deletions

View File

@ -59,8 +59,8 @@
"type": "file" "type": "file"
}, },
{ {
"destination": "/etc/systemd/system/tailscale.service", "destination": "/etc/netplan/10-network.yaml",
"source": "files/tailscale.service", "source": "files/network-dev.yaml",
"type": "file" "type": "file"
}, },
{ {

View File

@ -48,6 +48,11 @@
"source": "files/user-data_cnode", "source": "files/user-data_cnode",
"type": "file" "type": "file"
}, },
{
"destination": "/etc/netplan/10-network.yaml",
"source": "files/netplan-node.yaml",
"type": "file"
},
{ {
"scripts": [ "scripts": [
"scripts/setup-base.sh", "scripts/setup-base.sh",

View File

@ -0,0 +1,14 @@
network:
version: 2
renderer: networkd
ethernets:
eth0:
dhcp4: yes
dhcp6: yes
eth1:
dhcp4: no
dhcp6: no
addresses:
- "192.168.4.64/24"
# dev nodes may also use wireless, which requires serial console to setup.

View File

@ -0,0 +1,7 @@
network:
version: 2
renderer: networkd
ethernets:
eth0:
dhcp4: yes
dhcp6: yes

View File

@ -1,18 +0,0 @@
[Unit]
Description=Tailscale
Documentation=https://tailscale.com/kb/
Wants=network-online.target
After=network-online.target
AssertFileIsExecutable=/usr/bin/tailscaled
[Service]
User=root
Group=root
ExecStart=/usr/bin/tailscale up --advertise-routes=192.168.4.1/24
ExecStop=
# Let systemd restart this service always
Restart=always
[Install]
WantedBy=multi-user.target

View File

@ -5,11 +5,9 @@
chpasswd: chpasswd:
expire: false expire: false
list: list:
- name: ubuntu - ubuntu:ubuntu
password: ubuntu
type: text
hostname: cluster-cdev hostname: cdev
ssh_pwauth: true ssh_pwauth: true
ssh_authorized_keys: ssh_authorized_keys:
- ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIM47gCbb0BQOm6H4Ol8DEKD+CXTNYDJxe7QvJhdLZR/F kyle@petrichor - ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIM47gCbb0BQOm6H4Ol8DEKD+CXTNYDJxe7QvJhdLZR/F kyle@petrichor
@ -24,17 +22,21 @@ disable_root: true
resize_rootfs: true resize_rootfs: true
network: network:
Version: 2 version: 2
Renderer: networkd renderer: networkd
ethernets: ethernets:
eth0: eth0:
dhcp4: no dhcp4: no
dhcp6: no dhcp6: no
addresses: addresses:
"192.168.4.64/24" - 192.168.4.64/24
label: "cluster"
lifetime: forever
eth1: eth1:
dhcp4: yes dhcp4: yes
dhcp6: yes dhcp6: yes
wifis:
wlan0:
dhcp4: yes
dhcp6: yes
access-points:
"ATTjrThnDS":
password: "b#ifs9zv5epx"

View File

@ -5,9 +5,7 @@
chpasswd: chpasswd:
expire: false expire: false
list: list:
- name: ubuntu - ubuntu:ubuntu
password: ubuntu
type: text
hostname: node16 hostname: node16
ssh_pwauth: true ssh_pwauth: true
@ -23,10 +21,3 @@ disable_root: true
resize_rootfs: true resize_rootfs: true
network:
Version: 2
Renderer: networkd
ethernets:
eth0:
dhcp4: yes
dhcp6: yes

View File

@ -6,6 +6,3 @@ export DEBIAN_FRONTEND=noninteractive
echo "[+] installing cdev node packages" echo "[+] installing cdev node packages"
apt-get --force-yes -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" -y install dnsmasq picocom wpasupplicant apt-get --force-yes -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" -y install dnsmasq picocom wpasupplicant
echo "[+] installing tailscale"
curl -fsSL https://tailscale.com/install.sh | sh

View File

@ -2,17 +2,5 @@
set -euxo pipefail set -euxo pipefail
source /etc/os-release
case "${ID}" in
ubuntu)
SYSTEM_USER=ubuntu
SYSTEM_HOME=/home/${SYSTEM_USER}
;;
*)
SYSTEM_USER=root
SYSTEM_HOME=/root
;;
esac
apt-get -y install openssh-server apt-get -y install openssh-server

View File

@ -5,6 +5,8 @@ boards:
files: files:
- source: files/user-data_cnode - source: files/user-data_cnode
destination: /boot/firmware/user-data destination: /boot/firmware/user-data
- source: files/netplan-node.yaml
destination: /etc/netplan/10-network.yaml
scripts: scripts:
- scripts/setup-base.sh - scripts/setup-base.sh
- scripts/setup-ssh.sh - scripts/setup-ssh.sh
@ -18,8 +20,8 @@ boards:
destination: /etc/hosts destination: /etc/hosts
- source: files/dnsmasq.conf - source: files/dnsmasq.conf
destination: /etc/dnsmasq.conf destination: /etc/dnsmasq.conf
- source: files/tailscale.service - source: files/netplan-dev.yaml
destination: /etc/systemd/system/tailscale.service destination: /etc/netplan/10-network.yaml
scripts: scripts:
- scripts/setup-base.sh - scripts/setup-base.sh
- scripts/setup-ssh.sh - scripts/setup-ssh.sh