Provisioning vmware templates - template provisions, but nothing is configured

I’m very new to Foreman. I spent all of my waking hours this weekend to deploying the software and getting it connected to one of our VMware hosts, and setting up some basic ansible plays for things like installing httpd and other applications.

It is my understanding that foreman should be able to set up network / hostname information automatically, but I’m failing to get there.

The template is rocky Linux 9.2. Foreman is able to deploy the server, and apply the name properly in vmware, but the vm itself appears to be untouched.

This is on the newest available version, 3.7, as I just downloaded and installed the software over the weekend.

I feel like i’m probably missing some obvious step, but since I have no idea how foreman communicates with the host before it has an IP, I’m a little lost.

I just went through this battle not too long ago so I will share my experience. First, make sure your template has cloud-init, perl, and open-vm-tools installed in your template and in the Operating Systems page in Foreman, make sure you have both your desired Cloud-init template and User data template configured. I would also add the katello-host-tools and katello-host-tools-tracer packages to your template for good measure. You will need to create a cloud-init config file which instructs the host to call back to Foreman to get it’s config. The file would look something like this:

datasource_list: [NoCloud]
datasource:
  NoCloud:
    seedfrom: http://foreman.example.com/userdata/

You can call that file something like foreman_cloud_init.cfg and drop it in /etc/cloud/cloud.cfg.d/. There’s some config you’ll also need to do to prevent cloud-init from configuring the network on the VM. Basically another .cfg file that you will need to create and will need to drop in the same path:

network:
  config: disabled

You’ll also want to have the Katello cert added to that template (install the ca-certificates package if you don’t already have it installed).

wget -O /etc/pki/ca-trust/source/anchors/cloud-init-ca.crt http://foreman.example.com/pub/katello-server-ca.crt
update-ca-trust extract

You’ll also want to replace the contents of the default cloud.cfg file at /etc/cloud.cfg with something like this:

cloud_init_modules:
 - bootcmd

cloud_config_modules:
 - runcmd

cloud_final_modules:
 - scripts-per-once
 - scripts-per-boot
 - scripts-per-instance
 - scripts-user
 - phone-home

system_info:
  distro: rhel
  paths:
    cloud_dir: /var/lib/cloud
    templates_dir: /etc/cloud/templates
  ssh_svcname: sshd

Basically all of this info is here and you should be able to following along.

https://docs.theforeman.org/nightly/Provisioning_Hosts/index-foreman-el.html#Using_VMware_Cloud_Init_and_Userdata_Templates_for_Provisioning_provisioning

Just perform the rest of the cleanup tasks on your template, convert that to a VMware template, configure that template in your Compute Resources config and you should be good to go.

Thanks very much! I didn’t have cloud-init on my template, but I’ve remedied that, and set it up the way you mentioned.
I’m seeing i don’t appear to have katello installed on my Foreman host, I was going to create a second server for hosting rpm repos, and install katello on there - should I wipe the install and redo it with katello on the main host as well?

I’m definitely not skilled enough with Foreman to answer that question. I did my install with Katello all on the same VM using the install guide

https://docs.theforeman.org/3.6/Installing_Server/index-katello.html

The recommended storage is listed there so I created my partitions accordingly

Thanks, I’m early enough in that I may blow my install away and start from scratch, with katello in there from the start.