1

Since my company needs time to consider security issues with WinRM which is used by Ansible to manage windows hosts I was thinking about doing it via Cygwin ssh connection which we already have installed. Is this even possible? I tried to setup env variables like that:

        ansible_connection: ssh
        ansible_shell_type: cmd

End I'm trying to create a folder with the folliwng playbook:

- name: Ensure C:\Temp exists
win_file:
    path: C:\Temp
    state: directory

Gathering Facts is succesfull, but I'm getting: FAILED! => {"changed": false, "msg": "Unhandled exception while executing module: The system cannot find the path specified"}

  • Can you paste the verbose output (`-vv`) of the error? I'm wondering if maybe the backslash is being treated as an escape – Matt P Sep 26 '19 at 23:27

1 Answers1

1

In theory, Ansible, since v.2.8, supports doing connections through SSH, new windows even come with a Microsoft fork of OpenSSH. I am having trouble to make it work (that's how I ended up here), but I recommend you to take a look to the following links:

If you can do SSH using the PK, but you get an unreachable from Ansible, you may need to check also this:

For Windows Server 2019/10's OpenSSH configuration:

xCovelus
  • 578
  • 1
  • 9
  • 20
  • 1
    That's how it has ended. I was looking for a solution to use Cygwin, since my corpo "devops/security" team didn't let me install WinRM, so I told them to take care of this, and they end up using OpenSSL. So I can assure you it is possible to make it work, but don't know the details. – Wojtek Mlodzianowski Jan 20 '20 at 09:35
  • Thanks for your comment. So, I am not sure if I understood, let me ask, please: do you know if they finally used the Microsoft fork of OpenSSL included in Windows (at least, Server 2019), or did they install another OpenSSL client? I can make the Win Srv. 2019's OpenSSL work, I can connect from a remote shell, but once I test in Ansible, it just fails... – xCovelus Jan 20 '20 at 09:52
  • They have installed OpenSSH (you mean ssh not ssl right?:P) from https://github.com/PowerShell/Win32-OpenSSH/releases/download/v8.0.0.0p1-Beta/OpenSSH-Win64.zip – Wojtek Mlodzianowski Jan 21 '20 at 11:50
  • ups, sorry, yes my mistake, OpenSSH, I edit it now Thanks for your comment :) – xCovelus Jan 21 '20 at 14:06