How to automate bare metal install?

I (think I) understand how cloud-config.yml works, you pass it to the installer and it merges it with the config for the installation. Hence, SSH keys in it apply only to the version installed on disk.
And to SSH into the installer, I would need to passwd first.
Given that I don’t have a compatible keyboard, how would I:

  • run a script in the iso image shell to just install unconditionally without keyboard input
  • set ssh key or password on the iso image (can obviously be accomplished with the above point)
    I am pretty sure there is a way without building rancher/os myself from git.
1 Like

You can use runcmd or write file in your init:

https://rancher.com/docs/os/v1.2/en/configuration/running-commands

Torpi

Thank you for your response.
AFAIK, runcmd is just a cloud-config.yml directive to execute arbitrary commands.
Where would I find the cloud-config.yml that instructs the usb live boot itself?
Furthermore, that doesn’t seem like an appropriate spot to run sudo ros install -f -c cloud-config.yml -d /dev/sda, since runcmd commands run before the system is fully initialized?
I am looking to run ros install -f -c cloud-config.yml -d /dev/sda around the time auto-logon console is presented.

I’ve seen people doing it. Ex: rancheros-autoinstall.yml · GitHub

GAH! I avoided responding to this for so long. I know that RancherOS is officially dead, but for the people trying to keep it alive over at BurmillaOS, can you please answer this part of the question?:

Where would I find the cloud-config.yml that instructs the usb live boot itself?

Or more importantly, where would you put the cloud-config.yml for a bare-metal install?

  • :x: You can’t put it on the USB live boot because you can’t mount anything while the OS is running from memory.
  • :x: You can’t fetch a cloud-config.yml file online since you don’t have internet
  • :x: Writing the cloud-config.yml file on the spot would
    • be pure hell.
    • defeat the original point of the question of automating an install.

I have always wanted to know how to overcome this limitation.

Thank you.

To answer my own question: you can mount in memory. It’s nothing fancy and it might seem confusing because mount only reports an overlay so you might think you have to do something with system-docker, but you don’t. Here’s what would’ve helped me:

  • Use rufus to make your USB; or more importantly, don’t use dd (I just switched over to Windows for this part, but I am happy to hear linux alternatives) – dd will make the FS on your drive read-only so you can’t throw in misc. files like a custom cloud-config. This might also alleviate problems between machines or if you test in virtualbox that use UEFI or not (it did for me).
  • Use blkid and fdisk -l to track down what the file system path is; mine was /dev/sda1
  • Use mount like normal:
$ mkdir /media/usb
$ mount /dev/sda1 /media/usb
1 Like