vmware-samples / packer-examples-for-vsphere

Packer Examples for vSphere
https://vmware-samples.github.io/packer-examples-for-vsphere/
Other
825 stars 325 forks source link

Cloud-init is disabled in Ubuntu 24.04 images with `vm_guest_os_cloudinit=true` #939

Closed sepsh closed 4 months ago

sepsh commented 4 months ago

Code of Conduct

Project Version

develop

VMware vSphere

7.0.3

HashiCorp Packer

1.11.0

HashiCorp Packer Plugin for VMware vSphere

1.3.0

Guest Operating System

Ubuntu Server 24.04 LTS

Environment Details

Description

Hi. When I tried building an image from Ubuntu Server 24.04 LTS and cloning it with Terraform, I noticed that the user configuration, hostname and network configuration and other stuff set in cloud-init templates, was not applied.

Then I ran:

cloud-init status

I got disabled

Expected Behavior

Cloud-init beeing enabled

Actual Behavior

Cloud-init is not enabled

Steps to Reproduce

Log Fragments and Files

No response

Screenshots

Screenshot_20240618_191253

Additional Context

No response

tenthirtyam commented 4 months ago

@burnsjared0415 can you take a look at this one?

sepsh commented 4 months ago

One way to fix that could be to add a task in packer/ansible/roles/configure/tasks right before https://github.com/vmware-samples/packer-examples-for-vsphere/blob/d2fde04a56867801bdaeb550e8aed3bf8e62af3f/ansible/roles/configure/tasks/debian.yml#L51

Just adding this could fix it maybe,

- file:
    path: "/etc/cloud/cloud-init.disabled"
    state: absent

but I'm not sure if it's the best way since this document exist: https://cloudinit.readthedocs.io/en/latest/howto/disable_cloud_init.html#method-2-kernel-command-line

burnsjared0415 commented 4 months ago

will take look this afternoon and look at the suggestion and test.

sepsh commented 4 months ago

thanks a lot

burnsjared0415 commented 4 months ago

@sepsh pull request is in to fix the issue, if you want to pull down the fix and see if it works?

tenthirtyam commented 4 months ago

Addressed in #940.

sepsh commented 4 months ago

Hi, Sorry for my delay. That solved my problem, Thanks a lot.