cloudbase / cloudbase-init

Cross-platform instance initialization
http://openstack.org
Apache License 2.0
421 stars 149 forks source link

cloudbase-init under Apache CloudStack #31

Closed Doni7722 closed 4 years ago

Doni7722 commented 4 years ago

Hi,

I would like to use cloudbase-init for our MS Windows templates in our CloudStack Cloud. However with cloud-init (under Linux systems) we are able to set the password anytime and multiple times. With cloudbase-init it does set the password - but only once. I believe that the cloudbase-init service checks on the VR if a file called saved_password is in there and if so it does not reset the password.

Is there a way or config to let cloudbase-init reset the password as much as I like or is this by design like that?

Regards

ader1990 commented 4 years ago

Hello,

In this regard, cloudbase-init works like cloud-init, checking if there is a saved password at the magic url at every reboot and applying the password to the default user Admin (if there is any password).

cloud-init: https://github.com/canonical/cloud-init/blob/master/cloudinit/sources/DataSourceCloudStack.py#L57

cloudbase-init: https://github.com/cloudbase/cloudbase-init/blob/master/cloudbaseinit/metadata/services/cloudstack.py#L155

From the CloudStack management UI (or from cli) you can reset the instance password and then you are required to reboot the VM. After reboot, cloudbase-init checks the magic URL and should find a new password + set it to the Admin user.

Thank you, Adrian Vladu

Doni7722 commented 4 years ago

Hi Adrian

Thanks for the explanation. That's not the case in my setup. When I do a reset over the UI (or cli) the password will be ignored... It just works for the first time.

Regards Liridon

ader1990 commented 4 years ago

@Doni7722 can you share the cloudbase-init configuration file and logs to debug the issue? Maybe the cloudstack base_url in cloudbase-init config is different from the actual one from your CloudStack deployment.

Doni7722 commented 4 years ago

Hi @ader1990 Very strange - It did work now but I had to do couple of steps (which in my eyes are not needed):

  1. Stop VM
  2. Reset PW over UI
  3. Start VM (password was not set)
  4. Stop VM
  5. Start VM (password was set)
  6. Login with new Password successful

Could you confirm this? I did attach the logs and config. cloudbase-config.txt cloudbase.log

Regards Liridon

ader1990 commented 4 years ago

You need to set in the config (so that cloudbase-init checks only for cloudstack metadata), otherwise there will be a long timeout while trying the other metadata providers to be checked -- in your case around 2 or more minutes:

metadata_services=cloudbaseinit.metadata.services.cloudstack.CloudStack

Can you retry with the new config?

Thanks, Adrian

Doni7722 commented 4 years ago

Hi @ader1990 You are right. I did reset the password and did start the VM only once after the reset. The password was not set at the beginning it took about 8 minutes until the new password was set by cloudbase-init (please see the logs attached). I did setup the config as you did mention (please see the new config attached) but it looks like cloudbase-init still tries to check other metadata providers (as I saw inside the logs).

cloudbase.log cloudbase-config.txt

May you have an idea on how to push this config?

Regards Liridon

ader1990 commented 4 years ago

The configuration file should be here: C:\Program Files\Cloudbase Solutions\Cloudbase-Init\conf\cloudbase-init.conf

To be sure, you can check how the cloudbase-init service is started. From cmd.exe: sc.exe qc cloudbase-init

Check for BINARY_PATH_NAME, it should have the cloudbase-init config file as a parameter.

ader1990 commented 4 years ago

@Doni7722 from the provided logs, the config file located at: 'C:\Program Files\Cloudbase Solutions\Cloudbase-Init\conf\cloudbase-init.conf'. There, you have to set: metadata_services=cloudbaseinit.metadata.services.cloudstack.CloudStack

Doni7722 commented 4 years ago

@ader1990 very nice - thanks a lot! I did set the config inside the cloudbase-init-unattend.conf... now it does work and is fast too.

I close this "issue".

Again many thanks and Regards Liridon

ader1990 commented 4 years ago

@ader1990 very nice - thanks a lot! I did set the config inside the cloudbase-init-unattend.conf... now it does work and is fast too.

I close this "issue".

Again many thanks and Regards Liridon

Great news, anytime. Adrian