aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/etc/cloud-init.cfg
blob: 6aa67d9c03e67971c62f1b18fdd68c5968c1d374 (plain) (blame)
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
#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