This repo provides an example of deploying a Ubuntu machine with some hardcoded values in both the metadata and userdata files included in the templates directory.
Cloud-init configuration is provided via the VMware guestinfo datasource. A sample Packer build that has the relevant dependencies pre-installed can be found here.