NETPLAN-GENERATE(8)

๐Ÿ’ซ NETPLAN-GENERATE(8) ๐Ÿ’ซ

okay bestie, so this is from the System Manager's Manual (section 8, iykyk) โ€” it's the glow-up guide for turning your Netplan YAML into actual backend config, and no cap, it's kinda iconic.


โœจ NAME โœจ

netplan-generate โ€” generate back-end configuration from Netplan YAML files ๐ŸŽ€


โœจ SYNOPSIS โœจ

netplan [--debug] generate -h|--help

netplan [--debug] generate [--root-dir ROOT_DIR] [--mapping MAPPING]

โœจ DESCRIPTION โœจ

so basically, netplan generate takes your Netplan YAML and converts it into config files that the back ends actually understand โ€” think systemd-networkd(8) or NetworkManager(8). it does not apply the generated configuration, okay? it's just doing the conversion, not the whole vibe check of actually running it. ๐Ÿ’…

you won't normally need to run this directly, because it's already run by netplan apply, netplan try, or at boot. so like, unless you're doing something specific, the main character energy is handled for you. โœจ

only if it's executed during the systemd initializing phase (i.e. "Early boot, before basic.target is reached"), will it attempt to start/apply the newly created service units. Requires feature: generate-just-in-time ๐Ÿ•

when called as a systemd.generator(7), all the parsing and validation errors will be ignored by default. if network definitions are skipped due to parsing errors, they might be incomplete โ€” which means the back end configuration emitted might not be fully valid. ๐Ÿ˜ญ (lowkey a red flag, but it's the documented behavior, fr fr)

for details of the configuration file format, see netplan(5). go off, bestie. ๐Ÿ“–


โœจ OPTIONS โœจ

  • -h, --help โ€” Print basic help. simple as that. ๐Ÿซถ
  • --debug โ€” Print debugging output during the process. for when you need to see the receipts. ๐Ÿ”
  • --root-dir ROOT_DIR โ€” Instead of looking in /{lib,etc,run}/netplan, look in /ROOT_DIR/{lib,etc,run}/netplan. it's giving "custom root directory realness." ๐Ÿ—‚๏ธ
  • --mapping MAPPING โ€” Instead of generating output files, parse the configuration files and print some internal information about the device specified in MAPPING. it's like a little peek behind the curtain. ๐Ÿ‘€

๐ŸŒˆ HANDLING MULTIPLE FILES ๐ŸŒˆ

there are 3 locations that netplan generate considers, and the way they stack is honestly such a mood:

  • /lib/netplan/*.yaml
  • /etc/netplan/*.yaml
  • /run/netplan/*.yaml

if there are multiple files with exactly the same name, then only one will be read. a file in /run/netplan will shadow (completely replace) a file with the same name in /etc/netplan. a file in /etc/netplan will itself shadow a file in /lib/netplan. so like, it's a whole hierarchy of "i'm the main character now." ๐Ÿ‘‘

or, in other words, /run/netplan is top priority, then /etc/netplan, with /lib/netplan having the lowest priority. periodt. ๐ŸŽฏ

if there are files with different names, then they are considered in lexicographical order โ€” regardless of the directory they're in. later files add to or override earlier files. for example, /run/netplan/10-xyz.yaml would be updated by /lib/netplan/20-abc.yaml. it's giving "alphabetical order is the vibe." ๐Ÿ”ค

if you have two files with the same key/setting, the following rules apply โ€” and yes, you need to know these:

  • if the values are YAML boolean or scalar values (numbers and strings) the old value is overwritten by the new value. boom, replaced. ๐Ÿ’ฅ
  • if the values are sequences, the sequences are concatenated โ€” the new values are appended to the old list. it's giving "the more the merrier." ๐ŸŽ‰
  • if the values are mappings, Netplan will examine the elements of the mappings in turn using these rules. recursive realness. ๐Ÿ”

๐ŸŒธ SEE ALSO ๐ŸŒธ

netplan(5), netplan-apply(8), netplan-try(8), systemd-networkd(8), NetworkManager(8) โ€” go read those too, bestie. ๐Ÿ’–


๐Ÿฆ‹ AUTHORS ๐Ÿฆ‹

Daniel Axtens (daniel.axtens@canonical.com). we stan. ๐Ÿซถ


this has been your netplan-generate(8) moment โ€” from the System Manager's Manual, version NETPLAN-GENERATE(8), dated whenever the manual says (iykyk). stay slay, stay configured. ๐Ÿ’…โœจ

periodt. ๐ŸŒˆ๐Ÿ’–

๐Ÿ“ฆ where this page comes from