Skip to content

Instantly share code, notes, and snippets.

@Informatic
Last active July 5, 2025 10:51
Show Gist options
  • Save Informatic/0b6b24374b54d09c77b9d25595cdbd47 to your computer and use it in GitHub Desktop.
Save Informatic/0b6b24374b54d09c77b9d25595cdbd47 to your computer and use it in GitHub Desktop.
cloud-init "nocloud" networking setup

cloud-init is absolute cancer. Its code is horrible. It has no documentation at all.

It took me 5 fucking hours to figure out how to properly configure networking on recent cloud-init (Ubuntu 16.04 cloud image) with local datasource.

It's not mentioned anywhere you need to provide dsmode: local. (but only if you need network-config, besides that everything is fine; someone below noted that -m flag does the same thing, good to know) Of course nobody needs documentation for network-config format either. (cloudinit/net/__init__.py is a protip, enjoy the feces dive)

Oh, and by the way - no, it's not possible to provide network-config to uvt-kvm without patching shit.

Use -N flag for cloud-localds for network-config.

dsmode: local
# ↑ THIS. SHIT.
---
version: 1
config:
- type: physical
name: ens3
subnets:
- control: auto
type: static
address: |
192.168.21.37
pre-up echo xD > /tmp/yesitsthereyo # quality configuration injection, real thing
#cloud-config
chpasswd:
list: |
root:password
expire: False
write_files:
- content: |
You don't really need that, just a bloody test.
path: /root/test.txt
@jonnyhoeven
Copy link

This saved me so much time! Fuck it, why even bother having one config for different network managers? Just a few run commands on the network manager and it was done. Mostly different cloud-config files for each linux distro anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment