Can split up my big monolithic answerfile for subiquity and cloud-init automated installations?

  • I’m working on automated Ubuntu server installs. Which are working fine.
  • I have an extensive file with more than 200 lines.
  • Obviously I should use version control and I should split content into individual files instead of modifying a big monolithic file.
  • I’m also working on automated server installs for RPM based distributions (Fedora, Centos…) with Kickstart.
  • Kickstart has an include command which lets me source other kickstart files. Can I achieve something similar with autoinstall/cloud-config formatted yaml files?
    • It doesn’t have to work like %include, just chopping the big file into smaller pieces and assemble or render the main file from the pieces in order would be a big help.
    • I haven’t used MAAS yet. if there is a different way how this is supposed to be done or what can be recommended for curtin/subiquity I will take a look at it.

I use ksflatten -c "${input_file}" -o "${output_file}" to generate a flat monolithic ks.cfg file, which I can put on a virtual ISO labeled “OEMDRV” in VirtualBox and run the installer without interaction. This way I can install Fedora Server, Centos Server, Fedora Workstation with Gnome and others while maintaining a set of simple *.ks files which may not apply to every configuration so I can comment them out or remove them for further testing. You may understand it a bit better whe you take a look at this:

Imagine you want to break up the file in sections like ssh, late-commands, user-data and others. late-commands and user-data may contain items with comments like »remove unwanted packages«, »configure motd« and much more which should be separate files on their own. As I said my file is over 200 lines long. Is there some yaml wizard around here who can do jq like kungfu with yaml? yq didn’t look convincing a few days ago when I tried to find answers for this problem.