can the openstack builder work with a windows image

620 views
Skip to first unread message

Glyn Davies

unread,
Sep 5, 2016, 2:58:37 PM9/5/16
to Packer
Hi folks,

I am trying to use packer to create a new windows instance on an openstack cloud. 

The current issue is that the openstack builder defaults to assuming it is building a linux image and therefore needs to check for an SSH connection. Is it not possible to support Windows with this builder?

Cheers,
Glyn

Alvaro Miranda Aguilera

unread,
Sep 5, 2016, 4:59:10 PM9/5/16
to packe...@googlegroups.com
Hello,

Packer by default will try to use ssh, you can override that to use WiRM with the communicator

ie
{
    "builders": [{
        "type": "amazon-ebs",
        "communicator": "ssh"
    }]
}

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to packer-tool+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/25c87296-5f10-4947-a91e-5bc6aa6f68bb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Rickard von Essen

unread,
Sep 6, 2016, 2:45:15 PM9/6/16
to packe...@googlegroups.com

I added support in the OpenStack builder for fetching a admin password specifically for Windows. So I have used it successfully for that.

I suggest that you post a example template.

Ensure that your image https://cloudbase.it/cloudbase-init/ installed.


Rickard von Essen

unread,
Sep 6, 2016, 2:45:15 PM9/6/16
to packe...@googlegroups.com

This template works for me:

{
  "_comment": "Windows 2012 R2 Server",

  "builders": [
    {
      "type": "openstack",
      "communicator": "winrm",
      "winrm_username": "administrator",
      "image_name": "step_get_password_TEST",
      "source_image": "cf593d97-6a1a-4dc6-b041-f54a3587a339",
      "flavor": "bff4c362-1a64-4895-bcbe-89b437815934",
      "floating_ip_pool": "ext-net-01"
}
  ],
  "provisioners": [
    {
      "type": "windows-shell",
      "inline": ["dir C:\\"]
    }
  ]
}

You can download a evaluation image of Windows 2012 from cloudbase.it and substitute source image, flavor, etc.

Glyn Davies

unread,
Sep 6, 2016, 7:30:34 PM9/6/16
to Packer
Hi Guys,

Thanks for the information.

I have tried that and it gets to the point where packer is waiting for WinRM to respond, it eventuall fails with http error 401 ( as shown ) and rolls back. 

  2016/09/07 11:10:37 packer: 2016/09/07 11:10:37 [DEBUG] connecting to remote shell using WinRM
  2016/09/07 11:10:37 packer: 2016/09/07 11:10:37 [ERROR] connection error: http error: 401 -
  2016/09/07 11:10:37 packer: 2016/09/07 11:10:37 [ERROR] WinRM connection err: http error: 401 -

here is the packer build file

{
  "builders": [{
  "type": "openstack",
        "communicator": "winrm",
        "winrm_username": "administrator",
        "winrm_password": "Super1234Secure ",
        "winrm_timeout": "7m",
        "winrm_insecure": "true",
  "image_name": "gd-windows-test-image-template",
  "source_image": "b0c87517-a0e9-406d-9076-002fb639ee72",
  "flavor": "c1.c2r8",
  "security_groups": ["default","rdp-access-from-cat-akl"],
  "floating_ip_pool": "public-net",
  "networks": ["49236d09-8107-43c6-aa1b-211730edb8e8"]
    }],
  "provisioners": [{
  "type": "powershell",
  "inline": ["(New-Object System.Net.WebClient).DownloadString(\"https://api.nz-por-1.catalystcloud.io:8443/swift/v1/PublicTestBinaries/Firefox Setup 48.0.2.exe\",\"C:\firefox.exe\")",
  "c:\firefox.exe -ms"]
    }]
}

If I run the following from a python shell at the same time, using the same credentials as above, with the floating IP address that packer generates it works just fine and returns the full ipconfig output.

  import winrm

  s = winrm.Session('150.242.xxx.xxx', auth=('administrator','Super1234Secure'))
  r = s.run_cmd('ipconfig', ['/all'])
  r.std_out

Thoughts??

Cheers,
Glyn


On Wednesday, 7 September 2016 06:45:15 UTC+12, Rickard von Essen wrote:

I added support in the OpenStack builder for fetching a admin password specifically for Windows. So I have used it successfully for that.

I suggest that you post a example template.

Ensure that your image https://cloudbase.it/cloudbase-init/ installed.

On Sep 5, 2016 10:59 PM, "Alvaro Miranda Aguilera" <kik...@gmail.com> wrote:
Hello,

Packer by default will try to use ssh, you can override that to use WiRM with the communicator

ie
{
    "builders": [{
        "type": "amazon-ebs",
        "communicator": "ssh"
    }]
}
On Mon, Sep 5, 2016 at 8:58 PM, Glyn Davies <glynda...@gmail.com> wrote:
Hi folks,

I am trying to use packer to create a new windows instance on an openstack cloud. 

The current issue is that the openstack builder defaults to assuming it is building a linux image and therefore needs to check for an SSH connection. Is it not possible to support Windows with this builder?

Cheers,
Glyn

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to packer-tool...@googlegroups.com.



--

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to packer-tool...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages