audiolize / vagrant-softlayer

This is a Vagrant plugin that adds a SoftLayer provider to Vagrant, allowing Vagrant to control and provision SoftLayer CCI instances.
MIT License
42 stars 15 forks source link

This may take a few minutes... is too vague #52

Closed lonniev closed 9 years ago

lonniev commented 9 years ago

I've been away from vagrant softlayer for a few months and I've forgotten the proper care and feeding for a vagrant session for SoftLayer.

The confusion starts with the seemingly very long wait for "Waiting for the machine to boot." and this misleading remark that "This may take a few minutes...".

It would help to say, "Waiting for SoftLayer instance provisioning to complete and this typically takes 20 or more minutes to complete..."

The confusion is compounded with the next messaging that follows the instance provisioning and that is the "Warning: Connection refused. Retrying..." message.

The natural user reaction is WTF? I just waited 20 minutes for provisioning to complete and now I need to wait for SSH to become available?

It may be that I've once again overlooked a crucial Vagrantfile flag that either improves the responsiveness, tones down the retry frequency, or corrects incorrect credentialing. But, if so, I don't immediately spot it and the README guidance here doesn't address these too-likely-to-occur situations.

lonniev commented 9 years ago

The root cause here is, I think, that the documentation is all written for an understandable Linux bias (go Linux!) but I find that my users keep dragging me to offer them Windows VMs and the documentation is not helpful enough for getting Windows VMs running on SL.

The SL boxes provide RDP connectivity with only the default Administrator account and password from the awkward SL portal interface. There's no ssh support, no winrm enabled, and no vagrant user.

To remedy all this:

@powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin

This will give you a suitable foundation for vagrant and chef provisioning of SL Windows VMs.

@ju2wheels and @emyl why not provide a ju2wheels box that has just this little bit more added to it for Windows. (You would at least get rid of me asking WTF every few months when I forget all this prep work.)

ju2wheels commented 9 years ago
  1. Build messages:
    • I think this was adequately solved in 0.4 with the addition of the transaction states (the same status as shown on the portal) being added to the debug output if you really want to see timely updates of where the build is at.
    • Theres too much variability in the build differences (Windows vs Linux, API side build hangs or delays) that make putting any kind of time estimate in the status message pointless.
    • What you see in terms of ssh messages can vary wildly depending on your setup whether you used correct ssh keys/password, if you correctly post-installed ssh (on Windows), whether you have selected the right IP (public/private) to use if your public IP is behind a firewall, if you remembered to connect to SL VPN for private only, or if you intended to use WinRM on Windows and forgot to configure it so ssh wouldnt kick in etc...
  2. Updates to the boxes: I havent invested any time in updating these right now for a few reasons:
    1. I think some of the other features are more important to implement and make the tool more feature complete first and I have to balance that with when I have free time to choose what to work on (work work comes first :-( ).
    2. I want to revamp the boxes tool in general to use ERB templates instead of the ugly mess of concatenated strings that the first iteration turned into. This will be doubly more useful as we add any bare metal functionality. The other thing this will help do is allow you to create your own custom boxes by providing a custom ERB template allowing you to pump in your own code and as well as bundle other files with the boxes at creation time.
    3. Uploading the boxes to Vagrant Cloud was a pain and insanely time consuming. When we add boxes for some of the bare metal stuff, the boxes will double. I will probably build a crude mechanize web scraper/automator to upload these once we get to this point as I also have to add @emyl and @anac0nda as admins to each box manually as well (one by one).
    4. I dont think even when we update this that choosing ssh or winrm in the box itself is a choice we should make as it requires customization for either to work regardless and I think the ERB option will allow you to easily make it redistributable and customized.
    5. The vagrant cloud is free (at least the way we implemented) so you can easily duplicate what we did and create your own boxes to offer and point them at your own GitHub projects (if you want direction id be happy to write a short wiki).
  3. Other odds and ends:
    • With regards to Windows I did make some headway into the WinRM post config automation stuff but its not anything extremely useful at this point other than being able to determine whats installed (KB's, standard exe's, updates from WSUS) and being able to trigger WSUS installs for particular packages and what not. Its not anywhere near release ready (Powershell is an absolute nightmare to code in), and I still need to make some interfaces to add/remove OS components that work against the old WIndows versions. I was effectively doing a poor mans Chocalely in a *nix dpkg/rpm style interface. We could then use this interface to create the WinRM normalization tool.
    • With the upstream softlayer_api version 3.0.1 I added a lot of wrappers around all password related stuff in the API and that includes the Software passwords (such as the one used for the OS admin/root user). The vagrant-softlayer-credentials tool I will add to contrib over the next two weeks or so once I get time to finish it will provide an interface to it. Im hoping we can somehow use this to provide an option other than SSH keys to allow us to pull the password from the API and pass it on to the WinRM/SSH shim tools in vagrant but no promises as I dont know how technically feasible it is yet.
lonniev commented 9 years ago

I commiserate with (3) and (5). My wish would be that the SL boxes for Windows with typical vagrant ssh capabilities were just sitting out in cloud space to begin with. It’s a bear trying to move the multi-gigabyte box files off a local machine to a cloud storage site that (1) accepts the big ones and (2) doesn’t mess up the checksumming several days midway through the uploads.

lonniev commented 9 years ago

I could do most of the SL-instance-to-vagrant-capable system with https://gist.github.com/lonniev/350a444c626119c31208 as an SL post_install script. However, it gets rejected at runtime because of the Set-ExecutionPolicy being restricted. When the elves inside the SL factory set up the instance, could they run Set-ExecutionPolicy unrestricted in the shell that launches the post_install URI?

ju2wheels commented 9 years ago

Marking as closed, most of the stuff we can tackle has been answered and anything relating to the SL API side or build process would have to opened against SL through a ticket.

lonniev commented 9 years ago
==> sl-oslc-alm: Rebuilding the SoftLayer instance...
==> sl-oslc-alm: Installing Chef cookbooks with Librarian-Chef...
==> sl-oslc-alm: Waiting for instance rebuilding. This may take a few minutes...
==> sl-oslc-alm: SoftLayer instance successfully rebuilt!
==> sl-oslc-alm: Waiting for machine to boot. This may take a few minutes...
==> sl-oslc-alm: Machine booted and ready!
==> sl-oslc-alm: Rsyncing folder: /Users/lonniev/Vagrants/softlayer-windows-windchillrlia/ => /vagrant

This is progress! It takes a ju2wheels LATEST Windows SL image, vagrants it up, and then runs a post_install that adds Chocolatey, OpenSSH, rsync, the vagrant user, and winrm.

Functionally, it makes ready the Windows SL VM for vagrant management; qualitatively, the SL behavior could be improved. It should run much more quickly (it takes about 20 minutes) and it should run reliably (it may abort for unknown reasons while being churned at the SL center).

Nevertheless, it is a great aid to getting vagrant-managed Windows VMs on SL.

The vagrantization work is done with

   sl.post_install = "https://gist.githubusercontent.com/lonniev/7d967b09add6ca1f3a8a/raw/6aba37509e2c7d851bb004aeaa19ec5b438052e6/post_install.bat"

in the Vagrantfile