Autoinstall-generator - tool to help with creation of autoinstall files based on preseed

Greetings all!

We’ve done some work lately to make it a bit easier to transition from Debian Installer to Subiquity. Those of you using preseed files may be interested in the new tool autoinstall-generator, available now as a Snap.

This work is being released with basic functionality in place - we know more things can be done here, and wanted to release and collect feedback.

In particular, it is understood that the preseed format supports things such as partitioning and network handling in more complicated ways than autoinstall-generator supports today.

Usage:

usage: autoinstall-generator.py [-h] [-c] [-d] [-V] infile [outfile]

positional arguments:
  infile         Debian install preseed file, or a dash to read stdin
  outfile        Subiquity autoinstall yaml

optional arguments:
  -h, --help     show this help message and exit
  -c, --cloud    output in cloud-config format
  -d, --debug    include commented out debug output explaining the conversions
                 performed
  -V, --version  show version and exit

Examples:

autoinstall-generator my-preseed.txt my-autoinstall.yaml

This basic usage will convert the preseed file to the autoinstall format.

autoinstall-generator my-preseed.txt my-cloud-config.yaml --cloud

This usage will convert the preseed file to the cloud-config format with the autoinstall data contained within the autoinstall section. Depending on how the data will be loaded to the installer, it may be needed in autoinstall or in cloud-config formats.

autoinstall-generator my-preseed.txt my-autoinstall.yaml --debug

This usage adds debug information to the end of the yaml in the form of comments.

The debug output looks like this:

#   4:   Directive: d-i debian-installer/locale string en_US
#        Mapped to: locale: en_US

This represents a single-line directive that was recognized and mapped to an Autoinstall equivalent. The ‘4’ indicates that the directive was found on line 4 of the input.

#   7: Unsupported: d-i debian-installer/language string en

Other directives are known to be unsupported, and are marked as such.

#  52:   Directive: d-i netcfg/get_ipaddress string 192.168.1.42
#  53:         And: d-i netcfg/get_netmask string 255.255.255.0
#        Mapped to: network:
#                     ethernets:
#                       any:
#                         addresses:
#                         - 192.168.1.42/24
#                         match:
#                           name: en*
#                     version: 2

Some directives get combined into a single section, such as the two netcfg items above.

# 436:   Directive: pkg-a pkg-a/my-q boolean false                                                                                   
# 437:         And: pkg-b pkg-a/my-other-q boolean true                                                                              
#        Mapped to: debconf-selections: |                                                                                            
#                     pkg-a pkg-a/my-q boolean false                                                                                 
#                     pkg-b pkg-a/my-other-q boolean true                                                                            

It will also pass along directives believed to be out of scope for the installer to the debconf-selections section. Note that the above are just fake examples and not real debconf selections.

An introduction to the autoinstall format can be found at https://ubuntu.com/server/docs/install/autoinstall. See also the quickstart guide and the Autoinstall file format reference.

I look at this as a work in progress so please share your thoughts.

Github: https://github.com/canonical/autoinstall-generator

Bugs & Feature requests: feel free to discuss below, or report on launchpad.

3 Likes

Can you input a kickstart config and convert it as well?

No kickstart support at this point - it’s something we’ve considered though.

1 Like

Does this tool also create the autoinstall files without the need for a already created preseed file?

No, autoinstall-generator assumes you’re bringing in preseed files and converts them, it won’t create autoinstalls from scratch. What you’re talking is something we have a design for but haven’t scheduled yet called autoinstall-editor.

I appreciate the feedback @andrewm659.

2 Likes