A summary of the content covered in the chapter.

We'll cover the following

This chapter communicated and deployed infrastructure with the remote Linux and Windows hosts by using different Ansible ad-hoc commands and playbooks.

We started with ad-hoc commands to connect with Linux and Windows hosts. We introduced additional variables required to connect to both of them. They were as follows:


  • ansible_user
  • ansible_password
  • ansible_ssh_common_args
    • Disables host key checking


  • ansible_user
  • ansible_password
  • ansible_connection
    • Defines the protocol to connect to the remote host
  • ansible_winrm_server_cert_validation
    • Ignores certificate warnings

Next, we looked into making how you can implement the same commands using playbooks. We introduced vars and vars_prompts to make the playbooks repeatable.

Building on the constructs learned you configured the Linux host as an Nginx server and the Windows host as an IIS server.

To configure a Linux host, we introduced the following essential packages and modules:

  • package: An OS package manager for Linux to install, update, and remove packages.
  • become: Elevate permissions to root user

Similarly, to configure the Windows Host, we introduced the following:

  • win_feature: To install or uninstall roles or features for Windows Server.
  • win_copy: To copy a file on the local host to a remote Windows location.
  • win_file: To create empty files, update file modifications of existing files, and/or to create directories.
  • Chocolatey: A package manager for Windows that automates software installs.
  • win_chocolatey: To install the dotnetcore-windowshosting package from the public Chocolatey feed.
  • notify: To notify if a change occurs.
  • handler: To execute an action based on a notification and consists of:
    • name
    • action

Delete the environments

In case you are going to visit the rest of the course later, you can delete the infrastructure to avoid any unexpected bills.

Disclaimer: Run the playbook at your own risk!
It is highly recommended you use a development AWS account and Azure subscription before executing these playbooks.

You can review the playbooks in the sections for Deploy to Azure and Deploy to AWS to delete the infrastructure.

Get hands-on with 1000+ tech skills courses.