radekg / terraform-provisioner-ansible

Ansible with Terraform 0.14.x
Apache License 2.0
572 stars 100 forks source link

Provide support for winrm connection #121

Open ElAntagonista opened 5 years ago

ElAntagonista commented 5 years ago

Although it might be a hustle, it would be great if this provisioner could provide support for provisioning windows machines with Ansible.

radekg commented 5 years ago

Hi @ElAntagonista, definitely. I have been thinking about this recently. My biggest problem with this is, I have no idea how to test it without having to launch a Windows VM. There isn't also an easy way to integrate such tests using a third-party CI. I might be wrong though.

gvcgael commented 5 years ago

@radekg You can use appveyor to run tests on Windows VM ( https://appveyor.com/ )

I used it for my personal projects with great success.

Kandan-Devops commented 5 years ago

@radekg - Is there any update to support for winrm connection. I have tried to downloaded latest version of 2.3.0 and its showing error like it only support SSH connections currently. If any latest versions available to support WINRM connection please let me know.

Regards, Kandan K

ivandeex commented 3 years ago

@radekg

You don't need appveyor nor azure-pipelines anymore to run your tests on Windows. The Github native CI ("actions") provide Windows, Linux and MacOS runners: https://docs.github.com/en/free-pro-team@latest/actions/reference/specifications-for-github-hosted-runners#supported-software

Here is a short working example of running a test on Github Windows runner: https://medium.com/rkttu/write-your-github-actions-workflow-for-build-windows-application-94e5a989f477

# .github/workflows/test.yml
name: radeks_test
on:
  push:
    branches:
      - master
jobs:
  test_radeks_provisioner:
    runs-on: windows-latest
    steps:
      - name: powershell
        shell: powershell
        run: |
          echo "hello from windows powershell"

A more complex example that installs golang toolchain on both Linux and Windows, builds executable and runs tests: https://github.com/rclone/rclone/blob/master/.github/workflows/build.yml#L135

How to configure WinRM:

Just run terraform under test right on the same runner and connect via WinRM to localhost (their Windows runner has docker installed but can't run Linux containers yet - https://github.community/t/docker-compose-on-windows-latest/17130).