Skip to content

Latest commit

 

History

History
79 lines (44 loc) · 3.89 KB

configure-windows-node.md

File metadata and controls

79 lines (44 loc) · 3.89 KB

Configure Your Local Windows Host as a Node

Normally ansible uses SSH to communicate with hosts, however, for windows we need to use WinRM. We will be follwing the steps outlined in Official Windows Setup

Since we are on Windows 10, we can skip the initial steps of upgrading the powershell and .NET Framework versions. If you are on an older version of windows please follow the steps in upgrading-powershell-and-net-framework.

Create Ansible User

You will need to manually create an ansible windows user on your system that is part of the Administrators group.

You can follow the step in this video: Configure a Windows Host for Ansible - ansible winrm

WinRM Setup

"There are two main components of the WinRM service that governs how Ansible can interface with the Windows host: the listener and the service configuration settings"

The "script ConfigureRemotingForAnsible.ps1 can be used to set up the basics. This script sets up both HTTP and HTTPS listeners with a self-signed certificate and enables the Basic authentication option on the service."

Note: Open a powershell terminal as Administrator

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$url = "https://raw.githubusercontent.com/ansible/ansible/devel/examples/scripts/ConfigureRemotingForAnsible.ps1"
$file = "$env:temp\ConfigureRemotingForAnsible.ps1"

(New-Object -TypeName System.Net.WebClient).DownloadFile($url, $file)

powershell.exe -ExecutionPolicy ByPass -File $file

Add Windows Host to AWX

Create a new Inventory named windows-local

image

Create a new Host using your Window's Host's IP address. You will need to add the basic authentication varibles using your newly created ansible user.

Note: credential for ansible user will be added later on as an object in AWX

image

ansible_connection: winrm
ansible_winrm_transport: basic
ansible_winrm_server_cert_validation: ignore

Add Windows Ansible User Credentials

Create a new Credential named windows-ansible-user.

Any Job Template that will run on your Windows local will need to use these credentials

image

Test Windows Host (Optional)

Create a new Project named windows-test. This project will use this git repository as its source

image

Create a new Job Template with the following:

  1. Name is hello-world-windows
  2. Inventory is windows-local
  3. Project is windows-test
  4. Playbook is /ansible/helloworld_win.yml. This playbook:
  5. Credentials are windows-ansible-user

image

Launch the job

image