Difficulty: Beginner
Estimated Time: 10 minutes

Don’t stop now! The next scenario will only take about 10 minutes to complete.

Ansible ImageId

Step 1 of 7

Step 1 - Prepare Environment for easier Toggling between Ansible and Target System

To make our lives easier later, let us define the commands "a" and "t" for quickly connecting from the base system to the ansible and target container:

Connect to the Ansible container:

a() { docker exec -it ansible bash -c "echo 'PS1='\''ansible# '\' >> /root/.bashrc; bash"; }

Connect to the Target container:

t() { docker exec -it target bash -c "echo 'PS1='\''target# '\' >> /root/.bashrc; bash"; }

In this tutorial, we already have started an ansible and a target container in the background. However, they have been started in the background, and they need some time to become available. Repeat using a docker ps command to check, whether Docker containers named 'ansible' and 'target' have been started already:

docker ps

Repeat sending the command until it looks similar to

CONTAINER ID      IMAGE                                   COMMAND                 CREATED         STATUS        PORTS NAMES
c96e3a45e164      ubuntu:14.04                            "/bin/bash -c 'whi..."  11 seconds ago  Up 9 seconds  target
caf61a258abb      virtuant/ansible-node-ubuntu14.04:v1    "/bin/bash -c 'whi..."  13 seconds ago  Up 11 seconds ansible

This can take as long than a minute. Be patient, sit back, and watch the magic happen!