1

I have setup an auto-install (Ubuntu 20.04 live server) with a user-data file.

My goal is to run a script after the installation is completed. So after the last reboot and the steps that happens there (like snap package installations).

The latest step I can find is the "late-commands" but that runs too early. The installation is not complete.

The script should be started right after "Execute cloud user/final scripts" has ended.

I tried doing a work-around with systemctl but I can't really make it run at the right time in the process.

Any ideas?

Anders
  • 142
  • 1
  • 8

1 Answers1

0

There is a user-data config key for the autoinstall file you might be able to use for this.

During the first boot of the installed system, cloud-init will use user-data config file to perform some of the install tasks. Notably, this is how the first user is created.

#cloud-config
autoinstall:
  version: 1
  user-data:
    write_files:
    - content: |
        cloud_init_has_run
      path: /cloud_init_flag
...

See this answer for more details

Tino
  • 101