[enhancement]: wsl datasource - Inherit user from Windows
Enhancement
On WSL, the user is prompted during installation to create a default user or you can provide it through cloud-init configuration. The user of the WSL instance is almost always the same user running the session on the Windows host. We could automatically create a default user in the WSL instance with the login name and properties inherited from the Windows system.
For instance we could add something like:
users:
- wsl: inherit|prompt
If wsl is not set then it defaults to prompt
I'm definitely open to discussion on a better configuration parameter.
Thanks for the idea @jibel! I'm not opposed to improvements to cloud-init on WSL, but I have a couple of questions and concerns with the proposal as it stands currently.
On WSL, the user is prompted during installation to create a default user
This is describing installation of WSL on Windows, right?
The user of the WSL instance is almost always the same user running the session on the Windows host.
Some users may want to use WSL to test cloud-init configurations locally before deploying to clouds. Anyone doing this would experience a change in behavior between WSL and other clouds, which would reduce some of the value of using cloud-init locally testing before deploying.
The proposed syntax isn't coherent with the rest of cloud-init's user configuration, and from a UI perspective special user-facing cloud-init behaviors for one platform in a module which is common to all platforms undermines the value of a common experience with cloud-init across all platforms.
I can see some users wanting this, but without a default password on Ubuntu, users will still need to configure a password anyways so I'm not sure that this really saves any extra work for the user since they will probably want to configure it anyways.
If wsl is not set then it defaults to prompt
Blocking boot of the operating system with interactive prompts would be a big change to cloud-init. Something external to cloud-init which does interactive prompting prior to launching an instance wouldn't be unwelcome, but cloud-init is expected to receive configurations preformed prior to doing anything, so I don't think that cloud-init is the right place to put this prompting behavior.
@jibel Thanks for chatting today.
I think that rather than changing the user-data cloud-config to support setting the default user to inherit from the host, we could make this into an optional WSL datasource-specific behavior. I imagine a boolean key in cloud.cfg which tells cloud-init to inherit from the host. This would enable a cloud-config that defines the default user to override this behavior. The boolean key could be packaged in the image to enable this behavior.
The only reason for having this key would be to allow disabling this behavior for users that expect to pass user-data cloud-config via cloud.cfg files.
This will:
- allow us to meet the desired behavior
- keep datasource-specific behaviour out of cloud-config
- give user the ability to override this behavior in user-data and disable this feature in cloud.cfg