boxcutter/ubuntu

Can't change password from Vagrant

genixpro opened this issue · 2 comments

Hello there! Thank you so much for providing such great community packer.io scripts!

I have one thing that I am tremendously confused on. I have created my own variables file, which looks like this:
{
"cpus": "4",
"disk_size": "65536",
"install_vagrant_key": "false",
"iso_checksum": "f529548fa7468f2d8413b8427d8e383b830df5f6",
"iso_checksum_type": "sha1",
"iso_name": "ubuntu-16.04.2-server-amd64.iso",
"iso_path": "/home/bradley/Downloads",
"iso_url": "http://releases.ubuntu.com/16.04/ubuntu-16.04.2-server-amd64.iso",
"locale": "en_US",
"memory": "4096",
"hostname": "electricbrain",
"ssh_fullname": "electricbrain",
"ssh_password": "vagrant",
"ssh_username": "electricbrain",
"version": "0.1.0",
"vm_name": "electricbrain"
}

And this file works great! However, when I change ssh_password to anything other then "vagrant", the script will fail. Currently I am just generating the VM and then manually going in and changing the password after. Is there another way of accomplishing this?

@genixpro What method are you using to build these templates? The user variables ssh_password and ssh_username are designed to be used by the vagrant.sh provision script in the scripts folder. If you call packer validate -var-file yourvarfile ubuntu.json does it complain about anything?

Not a straightforward way. You also need to change the username/password in the preseed files. With packer, there's no straightforward way to parameterize these things and not something we've worked further to sort out.