1

I have created custom automatic ubuntu 22 and 24 ISO and having more than 25+ physical servers. So I am going to use the same custom iso to install those 25+ physical servers. As those servers will have different hostnames, in user-data file which i have appended in the custom ISO, I have mentioned like below for hostname:

  identity:
    hostname: null
    username: ubuntu
    password: test123

installation is getting stuck and throwning error as 'Malformed autoinstall in identity section'

If if give like this,

  identity:
    hostname: ''
    username: ubuntu
    password: test123

Its taking hostname as localhost.

The command which I am using to assign hostname via boot command is as below:

    linux   /casper/vmlinuz quiet autoinstall ds=nocloud\;s=/cdrom/server/  ip=SERVERIP::GATEWAYIP:NETMASK:HOSTNAME:eno2:off:DNSSERVERIP quiet ---

Please help me that how to set preferred hostname via boot command and how to mention user-data to refer the boot command for hostname.

Priya
  • 45
  • 3

1 Answers1

1

You can try to use early-commands.

A user-data file like this can parse the hostname provided in the kernel arguments and insert it into the autoinstall configuration.

#cloud-config
autoinstall:
  identity:
    hostname: REPLACEHOSTNAME
    username: ubuntu
    password: test123
  early-commands:
    - |
      MYHOSTNAME=$(cat /proc/cmdline | grep -o 'ip=[^ ]*' | awk -F: '{print $5}')
      sed -i -e "s/REPLACEHOSTNAME/${MYHOSTNAME}/" /autoinstall.yaml

I have not tested this.


see also