Unable to setup a New Virtual Machine with automation pipeline

Please replace this text with a description of your issue
Hi, I am new to Ansible and my project is to use Ansible to create a small system in Vmware. I have done several steps including: creating clusters, adding host ESXI, configuring the switch, config some settings and finally able to creating a new VM using file .iso (ubuntu-18.04.6-live-server-amd64.iso) on VcenterServer.

The problem I have is when create a new VM, there is a configuration setup for OS system appear(picture below) and I cannot using script for automation this step.

Can someone give me some ideas to automate this step, using a script instead of manually by hand through the UI. Thanks for support, have a good day!

There’s the vmware_guest_sendkey module, but TBH I don’t know if this will really work. At the very least, it would be pretty cumbersome.

I think it would be easier to automate the installation itself, too. Maybe the Automated Server install quickstart can help you there.

Ah, great! I’ve just seen you’ve also tagged this with ubuntu. Maybe some Ubuntu expert (I am not) will also answer and help you there.

2 Likes

Hi,

What @mariolenz said. For unattended installs, it’s pretty much preseed (for Debian based systems), kickstart (EL based system) or cloud-init (both). Ubuntu seems to have a cloud-init wrapper linked in previous comment. Just prepare an ISO with one of those, push it to your datastore and boot on it instead.

Hashicorp Packer would be another great option to build your ISO and automate OS installs (here using a preseed). Then if you wish so, you could use the Ansible provisioner to run your playbooks on a freshly installed VM.

Now I get you chose Ansible to do so, and that’s totally fine. I just wanted to share another perspective.

1 Like

We’ve automated our ESXi installation and create an ISO with a kickstart file with Ansible and xorriso like this.

I haven’t updated this for quite some time, but it should™ still work. I’m pretty sure you could use packer to create the ISO in a similar way.

If you’re using Ansible anyway, creating the ISO with Ansible has the advantage that you can inject things from your inventory (like hostname, IP addresses and similar) into your kickstart / preseed / cloud-init / whatever file.

2 Likes

Thanks @ptn and @mariolenz for the solutions above. I will try it to see if it works. Have a great day!

1 Like