Skip to content

Instantly share code, notes, and snippets.

@asalhani
Last active December 14, 2019 18:13
Show Gist options
  • Save asalhani/7e382c5f4c0817dc20e13cf443610573 to your computer and use it in GitHub Desktop.
Save asalhani/7e382c5f4c0817dc20e13cf443610573 to your computer and use it in GitHub Desktop.
Setup and Configure Ansible: Server: Zorin OS 15 (18.0.3) - Client: Windows 10

Install Ansible

sudo apt-get update
sudo apt-get install software-properties-common
sudo apt install ansible
sudo apt install python3-pip
sudo apt install python-pip
pip install --trusted-host files.pythonhosted.org --trusted-host pypi.org --trusted-host pypi.python.org oauthlib -vvv

pip3 --version
ansible --version

Configure Windows Client

on windows machine, do the following:

Enable-PSRemoting -SkipNetworkProfileCheck -Force
winrm quickconfig

winrm set winrm/config/Client/auth '@{Basic = "true"}'
winrm set winrm/config/Service/auth '@{Basic = "true"}'
winrm set winrm/config/Client '@{AllowUnencrypted = "true"}'
winrm set winrm/config/Service '@{AllowUnencrypted = "true"}'


Set-Item WSMan:\localhost\Client\TrustedHosts -Value '192.168.211.1,192.168.99.1,10.31.147.159,172.20.144.1'
netsh advfirewall firewall add rule name="WinRM-HTTPS" dir=in localport=5986 protocol=TCP action=allow
  • Check windows Auth. status
Get-ChildItem WSMan:\localhost\Service\Auth
  • Get windows (WinRM) configuration:
winrm get winrm/config

Test WinRM connection:

  • provide user name and pwd for LOCAL ADMIN (in case you are in domain)
$Credential = Get-Credential user
test-wsman 127.0.0.1 -Authentication Basic -Credential $Credential
winrs -r:http://127.0.0.1:5985/wsman -u:LOCAL_USER_NAME -p:PASSWORD ipconfig

Sampel:

winrs -r:http://127.0.0.1:5985/wsman -u:.\admin -p:123456 ipconfig
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment