Summary

A summary of the content covered in this chapter.

We'll cover the following

In this chapter, we introduced tools and packages to connect to cloud providers, AWS and Azure, with your Ansible environment.

Let’s do a recap of the objectives we set at the start of the chapter:

  • Choose the connection method.
  • Create environment variables.
  • Verify connection to the cloud platform.

We have explored different Ansible Modules for connecting to both AWS and Azure.

Both of them require accounts and security keys to be set up to connect with them. We exposed these keys as Environment variables within the ansible container.

Once exposed, you used Ansible to connect and create resources to verify that the connection works.

Dockerfile

As we advance, we will use different environments, one for AWS and one for Azure, to keep our settings compact.

AWS

Your Ansible environment requires the following add-on packages to connect with AWS:

  • boto
  • boto3
FROM ubuntu:latest
RUN apt-get update; \
apt install -y openssh-client; \
apt install -y python3-pip
RUN pip3 install --upgrade pip; \
pip3 install "ansible==2.9.12"; \
pip3 install boto; \
pip3 install boto3
Dockerfile

Azure

To connect with Azure, you require the following additional packages and tools on top of the basic Ansible setup:

  • Azure CLI
  • ansible[azure]
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
RUN pip3 install --upgrade pip; \
pip3 install "ansible==2.9.12"; \
pip3 install ansible[azure]
Dockerfile

Get hands-on with 1300+ tech skills courses.