Introduction

Get introduced to the Environment Setup, Docker and, Dockerfile.

Setting up an Ansible environment

We’ll start by laying down the foundations for you to build on as the course progresses.

To answer; “How do I set up an Ansible environment?”; we will explore the following three chapters:

  • Ansible Development with Containers
  • Connect to the Cloud
  • Deploy an Ansible Environment

Once connected to the cloud, we will dive into some basic Ansible ad-hoc commands and playbooks before deploying an Ansible environment.

Let’s get started with the first chapter.

Ansible environment with containers

Objective
Run Ansible within a Docker Container

Steps

  1. Install Docker.
  2. Create a Dockerfile.
  3. Build a Docker Image.
  4. Run a Docker Container.
  5. Push a Docker Image to DockerHub.

We will start by walking you through building an Ansible environment in the docker container. Using a container environment provides various benefits such as:

  • Provides a consistent development experience for you and your team.
  • Separates the Ansible environment from the infrastructure it aims to manage.
  • Reduces management overhead (less infrastructure to manage).
  • Provides an immutable Ansible environment.

For this purpose, we will be working with Docker.

Getting started with Docker

We have already talked about the importance of containers above. Docker is a container management tool. You can easily build, run, and deploy containers using Docker.

Our first objective of this chapter is to install Docker. We have provided you with a pre-configured environment with Docker already installed, so you don’t have to go through the hassle of installing it yourself.

You can play with the pre-configured terminal below.

Run the following command to see if Docker is installed or not.

docker --version

It will display the current version of Docker installed.

Get hands-on with 1000+ tech skills courses.