Home Business Analyst BA Agile Coach 1. Installing Ansible on Ubuntu

1. Installing Ansible on Ubuntu

21
0



An explainer on how to setup ansible to configure windows hosts.

dev.to post link:
https://dev.to/group3kb84/installing-ansible-on-ubuntu-1klm
Download link for latest Ubuntu LTS:
https://ubuntu.com/download/desktop
Commands:
-Install software-properties-common
sudo apt update && sudo apt install software-properties-common

-Add the ansible repository
sudo add-apt-repository –yes –update ppa:ansible/ansible

-Install ansible (You will only be able to run this if you have added the ansible repository!)
sudo apt install ansible

-Install pip
sudo apt install pip

-Use pip to install pywinrm
pip install “pywinrm = 0.2.2” (youtube doesn’t allow greater than signs but be sure to add these in the command before the equals sign anyway!!)

-Powershell script to allow ansible connection on windows
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$url = “https://raw.githubusercontent.com/ansible/ansible/devel/examples/scripts/ConfigureRemotingForAnsible.ps1”
$file = “$env:tempConfigureRemotingForAnsible.ps1”

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

powershell.exe -ExecutionPolicy ByPass -File $file

-Command to edit the hostfile on Ubuntu
sudo nano /etc/ansible/hosts

-Important content of the hosts file
[Windows]
192.168.56.104
192.168.56.107
[Windows:vars]
ansible_user = Administrator
ansible_password = root
ansible_connection = winrm
ansible_winrm_server_cert_validation = ignore

-Command used to test the connection
ansible Windows -m win_ping

source

LEAVE A REPLY

Please enter your comment!
Please enter your name here