Network Configuration and custom first boot script


We have a requirement to configure username, password, ssh, IP addr, gateway, dns and domain on the VM image we are creating and then we also need to change the apt mirror. Apart from that there are some custom scripts that need to run when the VM is started.

For reference we were using vmbuilder on Ubuntu. But now we have planned to migrate the workflow to packer.

However I couldn’t find any solution to configure packer with the set of requirements we have. Can anyone suggest a solution?