ggiamarchi / vagrant-openstack-provider

Use Vagrant to manage OpenStack Cloud instances.
MIT License
247 stars 101 forks source link

vagrant-openstack windows guest #264

Closed styk-tv closed 8 years ago

styk-tv commented 8 years ago

Is there confirmed way or an example way of spinning up windows with vagrant-openstack provider? Below is spinning my volume from image, creates an instance with winrm enabled (can telnet) but can't seem to find a way to get winrm confirmation and success. I tried many variations below lists credentials and settings twice but at no point they are picked up by vagrant-openstack plugin. Ssh seems to interfere.

require 'vagrant-openstack-provider'

Vagrant.configure('2') do |config|

config.vm.box       = 'openstack'
config.vm.guest = :windows
config.vm.communicator = 'winrm'
config.winrm.guest_port = "5985"
config.winrm.username = 'winuser'
config.winrm.password = 'winpass'

#vagrant-openstack provider can't live without below line
config.ssh.username = 'stack'
config.ssh.port = '5985'

config.vm.define :client do |ctl|

    ctl.vm.provider :openstack do |os|

        os.openstack_auth_url = 'http://192.168.7.170:5000/v2.0/tokens'
        os.username           = 'openstack_user'
        os.password           = 'openstack_pass'
        os.tenant_name        = 'openstack_tenant'
        os.flavor             = 'm1.medium'
        os.floating_ip_pool   = ['public']
        os.ssh_timeout = 600
#        os.ssh_disabled = true
        os.server_create_timeout = 1200
        os.server_active_timeout = 1200
        os.http.open_timeout = 180
        os.http.read_timeout = 180
        os.volume_boot = {
            image: '6f971b31-2ab2-4d0a-9103-16fa9065d937',
            size:  40,
            delete_on_destroy: true
        }

    end

    ctl.vm.guest = :windows
    ctl.vm.communicator = 'winrm'
    ctl.winrm.guest_port = "5985"
    ctl.winrm.username = 'winuser'
    ctl.winrm.password = 'winpass'

#    ctl.vm.provision :shell do |s|
#        s.path = "script.ps1"
#    end
end
end

Problem is that if I skip ssh alltogether:

Openstack Provider:
* vagrant standard configuration option `ssh.username` is required

when ssh.username it just keeps expecting ssh when ssh is disabled, there is no acknowledgement of winrm (therefore no PS1 script can be executed thereafter). premature success.

then tried to fool it by switching standard 22 port to winrm 5985 but

Bringing machine 'client' up with 'openstack' provider...
==> client: Finding flavor for server...
==> client: Finding image for server...
==> client: Launching a server with the following settings...
==> client:  -- Tenant          : devopsteam
==> client:  -- Name            : client
==> client:  -- Flavor          : m1.medium
==> client:  -- FlavorRef       : 3
==> client:  -- Boot volume     :  (vda)
==> client:  -- KeyPair         : vagrant-generated-nxpnmh8c
==> client: Waiting for the server to be built...
==> client: Using floating IP 192.168.7.205
==> client: Waiting for SSH to become available...
ssh: connect to host 192.168.7.205 port 5985: No route to host
ssh: connect to host 192.168.7.205 port 5985: No route to host
ssh: connect to host 192.168.7.205 port 5985: No route to host
ssh: connect to host 192.168.7.205 port 5985: No route to host
ssh: connect to host 192.168.7.205 port 5985: No route to host
==> client: Waiting for SSH to become available...
ssh: connect to host 192.168.7.205 port 5985: No route to host
ssh_exchange_identification: Connection closed by remote host
ssh_exchange_identification: Connection closed by remote host
ssh_exchange_identification: Connection closed by remote host
ssh_exchange_identification: Connection closed by remote host

then timeout because winrm is no ssh even though winrm is ready for final success confirmation (and/or ps1 shell script)

noresjo commented 8 years ago

Same here. SSH seems to be an implicit requirement.

Sharpie commented 8 years ago

I've opened PR #281 which fixes this by switching to the standard Vagrant WaitForCommunicator middleware which handles WinRM in addition to SSH.