Summary

A summary of the content covered in this chapter.

In this chapter, you set up your development environment and got it ready to build upon. For AWS, you deployed the following infrastructure:

  • A Virtual Private Cloud(VPC)
  • A subnet
  • An internet gateway
  • A route for public traffic into the VPC
  • Windows EC2 instance with Windows Server 2019 Amazon Machine Image(AMI)
  • Linux EC2 instance with Red Hat Enterprise Linux 8 Amazon Machine Image(AMI)

Similarly, for Azure, you deployed:

  • Virtual network
  • Subnet
  • Public IP address
  • Network Security Group
  • Network interface
  • Windows Server 2019 virtual machine
  • Linux virtual machine running CentOS

To deploy these resources using Ansible, we introduced different Ansible Modules for both AWS and Azure.

Once deployed, we explored the connection options to content with the infrastructure using Ansible again. Ansible uses the following tools to connect to the virtual machines:

  • WinRM to connect to Windows hosts.
  • SSH to connect to Linux hosts.

You installed the missing tools in our environment to connect to the deployed instances:

  • sshpass
  • winrm

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.

Dockerfile

To connect to the infrastructure deployed to both AWS and Azure, you installed the following packages:

  • sshpass for connecting to Linux Hosts.
  • winrm for connecting to Linux Hosts.

AWS

Review the updated Dockerfiles for AWS below:

Press + to interact
FROM ubuntu:latest
RUN apt-get update; \
apt install -y openssh-client; \
apt install -y python3-pip; \
apt install -y sshpass; \
RUN pip3 install --upgrade pip; \
pip3 install "ansible==2.9.12"; \
pip3 install boto; \
pip3 install boto3; \
pip3 install "pywinrm>=0.3.0"

Azure

Review the updated Dockerfiles and Azure below:

Press + to interact
FROM ubuntu:latest
RUN apt-get update; \
apt install openssh-client; \
apt-get install -y wget curl apt-transport-https; \
curl -sL https://aka.ms/InstallAzureCLIDeb | bash; \
apt install -y python3-pip;\
apt install -y sshpass; \
RUN pip3 install --upgrade pip; \
pip3 install "ansible==2.9.12"; \
pip3 install ansible[azure];\
pip3 install "pywinrm>=0.3.0"

Download the Source Code
You can download the playbooks and Dockerfile for the respective environments for this chapter from the Github repository, become Ansible.

Get hands-on with 1300+ tech skills courses.