How do I change the WinRM port in test-kitchen?

Andrew DuFour -

If you're using a non-vagrant driver and the Windows image you're standing up uses a non-standard WinRM port you can configure it in the transport section of your platform.

For example, if your WinRM port is 8888:


platforms:
  - name: windows2012r2
    transport:
      name: winrm
      port: 8888

In the case of Vagrant, your Vagrantfile should do the work for you. An example config to adjust the default WinRM port, and disable the WinRM SSL port forwarding is:


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

    config.vm.communicator = "winrm"
    config.winrm.guest_port = 8888
    config.vm.network :forwarded_port,
        guest: 8888,
        host: 18888,
        host_ip: "127.0.0.1",
        id: "winrm",
        auto_correct: true

    config.vm.network :forwarded_port, guest: 5986, host: 55986, id: "winrm-ssl", disabled: true

end

Remember, although we like to think of Chef as doing all the things, we integrate with other technologies down the stack and in some cases they are responsible for actions and delegation.

For more on magic you can do in a Vagrantfile please see Hashicorp's Vagrant documentation: https://www.vagrantup.com/docs/vagrantfile/

Have more questions? Submit a request

Comments

Powered by Zendesk