0

I have a Terraform script that is cloning a RedHat 8 VM on vSphere V7.

The VM is successfully cloned, but the user in my userdata is not created when the VM starts. If I reboot the VM after it is cloned, the user specified in the userdata is then created successfully.

I am not sure if this is a problem or feature of cloud-init and RedHat 8, or if there is something I need to do with the VM I am cloning from.

I have tried to clone from a VM and a Template, but I get the same problem with both. I have also run the following on the VM that is being cloned.

cloud-init clean --logs 
cloud-init clean --seed
rm -rf /var/lib/cloud

But my users are still not created until the VM is rebooted.

PrestonDocks
  • 215
  • 3
  • 11
  • 2
    I don't think there's enough information here for us to reproduce (or understand) the problem. `cloud-init` should run automatically and process the userdata whenever it boots on a "new" system (where "new" means "no instance directory exists in `/var/lib/cloud/instances` for the same machine id). If you are deleting `/var/lib/cloud/*` before the first boot, you should be good. It would be interesting to see the cloud-init logs from the initial boot. – larsks Jul 10 '23 at 14:10

0 Answers0