1. Installing Ansible on Ubuntu


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

    dev.to post link:
    Download link for latest Ubuntu LTS:
    -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
    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


    Previous articleTaller de Automatización con Ansible Para servidores Linux y Windows.
    Next articleDocker Network & Volume modules – #Ansible 42