Cloud-config let you send additional configuration to the cloud-init process running within your virtual machine. This can be a useful tool to ensure updates are installed as the VM is created, that custom users are created and lots of other possibilities. We recommend to check out the Cloud-Config documentation even though we have some examples on this page
Cloud-config snippets / examples
Create more users than the image default on instance creation
Code Block |
---|
#cloud-config
users:
- default
- name: username
gecos: Full Name Here
groups: sudo
sudo: ALL=(ALL) NOPASSWD:ALL
shell: /bin/bash
ssh_authorized_keys:
- ssh-ed25519 <key> <comment>
- ssh-rsa <key> <comment>
- ... |
If you don't include the "default" entry first in the users-block, the default user for the given image will NOT be created. Therefore: keep it. Full documentation on this, here
Add additional SSH keys to the default user
Code Block |
---|
#cloud-config
ssh_authorized_keys:
- ssh-rsa <key> <comment>
- ssh-ed25519 <key> <comment> |
Upgrade packages on boot
Code Block |
---|
#cloud-config
package_upgrade: true |
Set timezone
Code Block |
---|
#cloud-config
timezone: "Europe/Oslo" |
Enable NTNU login via LDAP
Info |
---|
This is only tested and verified on Ubuntu Server 20.04 |
...