Creating autoinstall configuration

When any system is installed using the Ubuntu installer, an autoinstall file for repeating the installation is created at /var/log/installer/autoinstall-user-data. Providing autoinstall configuration describes the two ways of delivering this autoinstall configuration to Ubuntu installer.

The structure of an autoinstall configuration

Go to the Autoinstall configuration reference manual for full details on the supported autoinstall directives.

#cloud-config
autoinstall:
    version: 1
    identity:
        hostname: hostname
        username: username
        password: $crypted_pass

Here is an example file that shows most of the autoinstall directives:

#cloud-config
autoinstall:
    version: 1
    reporting:
        hook:
            type: webhook
            endpoint: http://example.com/endpoint/path
    early-commands:
        - ping -c1 198.162.1.1
    locale: en_US
    keyboard:
        layout: gb
        variant: dvorak
    network:
        network:
            version: 2
            ethernets:
                enp0s25:
                   dhcp4: yes
                enp3s0: {}
                enp4s0: {}
            bonds:
                bond0:
                    dhcp4: yes
                    interfaces:
                        - enp3s0
                        - enp4s0
                    parameters:
                        mode: active-backup
                        primary: enp3s0
    proxy: http://squid.internal:3128/
    apt:
        primary:
            - arches: [default]
              uri: http://repo.internal/
        sources:
            my-ppa.list:
                source: "deb http://ppa.launchpad.net/curtin-dev/test-archive/ubuntu $RELEASE main"
                keyid: B59D 5F15 97A5 04B7 E230  6DCA 0620 BBCF 0368 3F77
    storage:
        layout:
            name: lvm
    identity:
        hostname: hostname
        username: username
        password: $crypted_pass
    ssh:
        install-server: yes
        authorized-keys:
          - $key
        allow-pw: no
    snaps:
        - name: go
          channel: 1.20/stable
          classic: true
    debconf-selections: |
        bind9      bind9/run-resolvconf    boolean false
    packages:
        - libreoffice
        - dns-server^
    user-data:
        disable_root: false
    late-commands:
        - sed -ie 's/GRUB_TIMEOUT=.*/GRUB_TIMEOUT=30/' /target/etc/default/grub
    error-commands:
        - tar c /var/log/installer | nc 192.168.0.1 1000