diff --git a/packer/boards/cm4-cdev-ubuntu-22.04.2.json b/packer/boards/cm4-cdev-ubuntu-22.04.2.json index 67553aa..4993d9b 100644 --- a/packer/boards/cm4-cdev-ubuntu-22.04.2.json +++ b/packer/boards/cm4-cdev-ubuntu-22.04.2.json @@ -59,8 +59,8 @@ "type": "file" }, { - "destination": "/etc/systemd/system/tailscale.service", - "source": "files/tailscale.service", + "destination": "/etc/netplan/10-network.yaml", + "source": "files/network-dev.yaml", "type": "file" }, { diff --git a/packer/boards/cm4-cnode-ubuntu-22.04.2.json b/packer/boards/cm4-cnode-ubuntu-22.04.2.json index 411e299..493fc38 100644 --- a/packer/boards/cm4-cnode-ubuntu-22.04.2.json +++ b/packer/boards/cm4-cnode-ubuntu-22.04.2.json @@ -48,6 +48,11 @@ "source": "files/user-data_cnode", "type": "file" }, + { + "destination": "/etc/netplan/10-network.yaml", + "source": "files/netplan-node.yaml", + "type": "file" + }, { "scripts": [ "scripts/setup-base.sh", diff --git a/packer/files/netplan-dev.yaml b/packer/files/netplan-dev.yaml new file mode 100644 index 0000000..32b3888 --- /dev/null +++ b/packer/files/netplan-dev.yaml @@ -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. diff --git a/packer/files/netplan-node.yaml b/packer/files/netplan-node.yaml new file mode 100644 index 0000000..2e69d5a --- /dev/null +++ b/packer/files/netplan-node.yaml @@ -0,0 +1,7 @@ +network: + version: 2 + renderer: networkd + ethernets: + eth0: + dhcp4: yes + dhcp6: yes diff --git a/packer/files/tailscale.service b/packer/files/tailscale.service deleted file mode 100644 index 9522262..0000000 --- a/packer/files/tailscale.service +++ /dev/null @@ -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 \ No newline at end of file diff --git a/packer/files/user-data_cdev b/packer/files/user-data_cdev index e6c6c3b..82716ee 100644 --- a/packer/files/user-data_cdev +++ b/packer/files/user-data_cdev @@ -5,11 +5,9 @@ chpasswd: expire: false list: - - name: ubuntu - password: ubuntu - type: text + - ubuntu:ubuntu -hostname: cluster-cdev +hostname: cdev ssh_pwauth: true ssh_authorized_keys: - ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIM47gCbb0BQOm6H4Ol8DEKD+CXTNYDJxe7QvJhdLZR/F kyle@petrichor @@ -24,17 +22,21 @@ disable_root: true resize_rootfs: true network: - Version: 2 - Renderer: networkd + version: 2 + renderer: networkd ethernets: eth0: dhcp4: no dhcp6: no addresses: - "192.168.4.64/24" - label: "cluster" - lifetime: forever + - 192.168.4.64/24 eth1: dhcp4: yes dhcp6: yes - + wifis: + wlan0: + dhcp4: yes + dhcp6: yes + access-points: + "ATTjrThnDS": + password: "b#ifs9zv5epx" diff --git a/packer/files/user-data_cnode b/packer/files/user-data_cnode index 4126651..0de7fb2 100644 --- a/packer/files/user-data_cnode +++ b/packer/files/user-data_cnode @@ -5,9 +5,7 @@ chpasswd: expire: false list: - - name: ubuntu - password: ubuntu - type: text + - ubuntu:ubuntu hostname: node16 ssh_pwauth: true @@ -23,10 +21,3 @@ disable_root: true resize_rootfs: true -network: - Version: 2 - Renderer: networkd - ethernets: - eth0: - dhcp4: yes - dhcp6: yes diff --git a/packer/scripts/setup-cdev.sh b/packer/scripts/setup-cdev.sh index ac0ab03..01d30f1 100755 --- a/packer/scripts/setup-cdev.sh +++ b/packer/scripts/setup-cdev.sh @@ -6,6 +6,3 @@ export DEBIAN_FRONTEND=noninteractive echo "[+] installing cdev node packages" 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 \ No newline at end of file diff --git a/packer/scripts/setup-ssh.sh b/packer/scripts/setup-ssh.sh index acaffaa..627a812 100755 --- a/packer/scripts/setup-ssh.sh +++ b/packer/scripts/setup-ssh.sh @@ -2,17 +2,5 @@ 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 diff --git a/packer/ubuntu-boards.yml b/packer/ubuntu-boards.yml index 431db9a..392d19e 100644 --- a/packer/ubuntu-boards.yml +++ b/packer/ubuntu-boards.yml @@ -5,6 +5,8 @@ boards: files: - source: files/user-data_cnode destination: /boot/firmware/user-data + - source: files/netplan-node.yaml + destination: /etc/netplan/10-network.yaml scripts: - scripts/setup-base.sh - scripts/setup-ssh.sh @@ -18,8 +20,8 @@ boards: destination: /etc/hosts - source: files/dnsmasq.conf destination: /etc/dnsmasq.conf - - source: files/tailscale.service - destination: /etc/systemd/system/tailscale.service + - source: files/netplan-dev.yaml + destination: /etc/netplan/10-network.yaml scripts: - scripts/setup-base.sh - scripts/setup-ssh.sh