I’m trying to set up some defaults for several of my Ubuntu machines running the Ubuntu 22.04 server. Here is my config:
#cloud-config
ssh_pwauth: false
groups:
- mygrp
users:
- name: myuser
gecos: myuser
sudo: ALL=(ALL) NOPASSWD:ALL
groups: [mygrp, sudo]
ssh_import_id: None
lock_passwd: true
shell: /bin/bash
# Replace the <ssh-pub-key> with the actual SSH public key
ssh_authorized_keys:
- <ssh-pub-key>
preserve_hostname: false
hostname: open-electrons-m1
manage_etc_hosts: true
# If this is set, 'root' will not be able to ssh in and they
# will get a message to login instead as the default $user
disable_root: true
After running the following commands on my Ubuntu 22.04 machine:
pi@openelectrons:/etc/cloud$ sudo cloud-init clean
pi@openelectrons:/etc/cloud$ sudo cloud-init init
What is wrong with this script that I have? I do not see any issues in the cloud-init.log. No error messages.
Running this command:
cat /etc/hostname
is not printing my-host-name
The user is also not created. What is happening with this script? I’m breaking my head around this!