#cloud-config # Minimal user-data: download bootstrap.sh from your file server and run it at first boot. # # 1. Host bootstrap.sh at a URL reachable from the device on first boot (e.g. your # provisioning portal or file server). Example: http://10.20.50.1:5000/files/bootstrap.sh # 2. Copy this file to the boot partition as "user-data" (with meta-data and optional network-config). # 3. Edit BOOTSTRAP_URL below to match your server (or set it once in the runcmd section). package_update: true package_upgrade: false packages: - curl # Ensure SSH is enabled and password auth allowed so you can log in after first boot write_files: - path: /etc/ssh/sshd_config.d/99-cloud-init.conf content: | PasswordAuthentication yes PermitRootLogin no runcmd: - systemctl enable ssh - systemctl start ssh # Download and run bootstrap script (edit URL to match your file server) - | BOOTSTRAP_URL="http://10.20.50.1:5000/files/bootstrap.sh" LOG="/var/log/cloud-init-bootstrap.log" if ! curl -fsSL "$BOOTSTRAP_URL" -o /tmp/bootstrap.sh 2>>"$LOG" || [ ! -s /tmp/bootstrap.sh ]; then echo "$(date -Iseconds) ERROR: Failed to download bootstrap.sh from $BOOTSTRAP_URL (file missing or empty)" >> "$LOG" exit 0 fi chmod +x /tmp/bootstrap.sh /tmp/bootstrap.sh - cloud-init single --name cc_final_message