AnswerBun.com

Replace WinRM with OpenSSH on Windows for use with Ansible on AWS

Server Fault Asked by Adam C on November 30, 2020

Currently when running extended builds (Packer/Ansible based) on Windows we have found that WinRM has errors so frequently as to be unusable and have had to fall back to running some large build jobs manually as a result. Using a host in AWS as the source of the builds (rather than remote) has helped somewhat, eliminating connectivity as one of the error causes, but the number of failures is excessive and costly, since the builds then restart from scratch even if they have been running for hours.

The Ansible documentation mentions that OpenSSH can be used (at your own risk since it is experimental) for configuring Windows hosts in lieu of WinRM. However, there is little guidance given in terms of how to set this up.

In addition to a suspicion that ssh might be more reliable than WinRM as a connection method for Ansible, using ssh on port 22 would simplify some of our security rules and bring Windows into line with our Linux build hosts from a connectivity perspective. The ideal would be to create a re-usable build job to allow us to create a base AMI (from the official Windows Server 2019 AMI) to act as a new base for our Packer/Ansible jobs. Having never used OpenSSH on Windows, nor attempted to use ssh to connect to Windows with Ansible, if anyone could share a working config or at least pointers that would be very much appreciated.

One Answer

This requires several steps, and you will generally want to update it every so often to get a more recent version of Windows.

Here is a repository on Github which will (in eu-west-1 by default) take the latest official Windows Server 2019 image and install OpenSSH, configure the server, copy keys such that the Administrator user is accessible over ssh, and finally create an AMI which will have ssh available on boot. This build will use WinRM to do the initial work, but once created ssh can be used instead.

Also included is an example of how to use that new base image in an Ansible run (to install some build tools) when connecting via ssh rather than WinRM.

Answered by Adam C on November 30, 2020

Add your own answers!

Related Questions

IPFIX collector with extension support

3  Asked on August 24, 2020 by oonska

   

how do I change realm login format in sssd?

1  Asked on August 23, 2020 by andrew

         

Access static web-server through managed switch

2  Asked on August 21, 2020 by imperialcode

       

URL rewrite in IIS 8.5 is not working I’m getting 404 instead

1  Asked on August 16, 2020 by jack-the-ripper

     

nginx + php 5.6 serving empty pages, can’t find error log

1  Asked on August 10, 2020 by john-moore

       

How to limit memory usage by application in linux?

4  Asked on August 7, 2020 by edomaur

   

Tool to maintain IBM x3650

0  Asked on August 7, 2020 by frantiseknebojsa

   

ansible register on template is not working

1  Asked on August 6, 2020 by boaz

 

inactive option not working for pam_lastlog.so

1  Asked on August 5, 2020 by jakov-sosic

     

IPVS transmitting packets to incorrect backends

0  Asked on August 1, 2020 by vignesh-sp

         

Curl to host and port not working from inside Docker container

0  Asked on July 26, 2020 by bhanu-praveen-g

   

Ask a Question

Get help from others!

© 2022 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP, SolveDir