Ansible preparation
As mentioned in the previous section, Ansible will use WinRM to interact with our Windows host.
Information
WinRM provides access to a Simple Object Access Protocol (SOAP)-like protocol called WS-Management. Unlike Secure Shell (SSH), which provides the user with an interactive shell to manage the host, WinRM accepts executed scripts, and the results are passed back to you.
Ansible requires us to install a few Python modules to enable it to use the protocol; these modules need to be installed as they are not typically installed alongside Ansible.
To install the module, if you are running on Ubuntu, run the following command:
$ sudo -H pip install pywinrm
On macOS, run the following:
$ pip install pywinrm
Once installed, we need to update our environment file to instruct Ansible to use the WinRM protocol rather than SSH.
Our updated hosts
file looks like the following file, which is a copy of the hosts.example
file from the Chapter07
folder...