-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for linux VMs #33
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the PoC! I think we should leave resizing of the disk out of scope for this PR. There is some very specific logic for macOS, I think in a follow up PR we can create similar steps for Linux and depending on imageConfig["os"]
add different steps.
version: 1 | ||
identity: | ||
hostname: ubuntu-server | ||
password: "$6$exDY1mhS4KUYCE/2$zmn9ToZwTKLhCw.b4/b.ZRTIZM30JZ4QrOQ2aOXJ8yk96xpcCof0kxKwuX1kqLG/ygbJ1f8wxED22bTL4F46P0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's this password? Should it be ubuntu
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should it be
ubuntu
?
Well it is:
echo 'ubuntu' |openssl passwd -6 -stdin -salt exDY1mhS4KUYCE/2
$6$exDY1mhS4KUYCE/2$zmn9ToZwTKLhCw.b4/b.ZRTIZM30JZ4QrOQ2aOXJ8yk96xpcCof0kxKwuX1kqLG/ygbJ1f8wxED22bTL4F46P0
Ok, shall I remove everything or shall I leave the OS detection and the following ? if isLinux {
ui.Error("Automatic partition resizing not implemented, guest OS might not see the full disk capacity.")
return multistep.ActionContinue
} The original step didn't have a check on ExitStatus so it will just print a |
It seems that we can offload most of the OS-specific logic from But this is for a separate PR, as noted by @fkorotkov. |
When rebasing on main, I had to leave a check to avoid failure with the disk parsing introduced on macOS. |
Resolves #32
I'm new to packer, go & provisioning in general so things might be ill formed but the example works.
Used https://ubuntu.com/server/docs/install/autoinstall-quickstart as a starting point for auto install.
A few notes:
It assumes the install process will shutdown the VM rather than restart it at the end of installation: the sample ubuntu autoinstall will just loop into the installer if the system is restarted rather than shutdown.
The auto-resize in the guest OS is probably less generic than the macOS one so
afixing the disk size is left to the user with generic shell provisioning steps.resize_disk_command
was introduced.The
boot_command
is hijacked to be used for the VM creation/installation rather than the following run.