#cloud-config package_update: true package_upgrade: true package_reboot_if_required: true users: - name: ${jsonencode(user)} lock_passwd: false hashed_passwd: '*' sudo: ALL=(ALL) NOPASSWD:ALL ssh_authorized_keys: ${jsonencode(ssh_keys)} shell: /bin/bash write_files: - path: /etc/ssh/sshd_config content: ${jsonencode(sshd_config)} runcmd: # Some previous to Ubuntu Noble, they switch SSH to socket activation; in # addition, they made it in a stupid way (as per usual); they seem to read # /etc/ssh/sshd_config, parse the Port value, and generate a systemd override # file on the fly, which is idiotic. Of course, it's not consistent between # different releases. Look here, I guess? # https://askubuntu.com/q/1439461 - systemctl daemon-reload - systemctl is-active --quiet ssh.socket && systemctl restart ssh.socket