Table of Contents
Why This Project?
The motivation behind this Docker Ansible Lab project is to eliminate the headaches associated with creating a lab environment for Ansible practice. The traditional setup demands a robust machine capable of running at least three VMs, with various configurations such as network establishment and SSH communication. This project aims to simplify the process by allowing users to set up a scalable lab environment within Docker, with minimal configuration requirements.
Project Goals
The primary goal of the Docker Ansible Lab project is to enable users to effortlessly set up a lab environment within a Docker container. Unlike traditional setups, this project offers scalability, allowing users to create more than three machines with ease. The emphasis here is on minimizing the setup steps and allowing users to dive straight into Ansible without worrying about the intricacies of lab configuration.
Documentation
Docker Ansible Lab Configuration
Note: This configuration will create a total of five nodes, including three Ubuntu and two Oracle Linux machines. Refer to the docker-compose.yaml
file for details.
Node Credentials:
- Username: zero
- Password: ][poiuy
Prerequisites
Before getting started, ensure the following prerequisites are met:
- Docker installed on your machine
- Docker Compose installed
- Docker daemon started
- For Ubuntu, consider adding your user to the
docker
group - Optionally, install the provided version (refer to the screenshot below) of higher
Usage Instructions
- Clone the repository and navigate to it.
- Run
docker-compose up -d
. - View the logs using
docker-compose logs -f
. - Wait for approximately 1-5 minutes until you see a message indicating "SUCCESS! ... Happy hacking!"
- Your Ansible lab is now ready!
Control-Host Usage
- Open a new terminal for each control host.
- Run
docker container exec -it control-host bash
. - Stay as the root user.
- In the container, navigate to
cd ~/ansible-project
as this is your base Ansible directory. - Your lab is ready! You can now control and configure all servers. Test server connections with
ansible all -m ping
.
Server Usage (Example for Server-1)
- Open a new terminal for each server.
- Run
docker container exec -it server-1 bash
. - Switch to the
zero
user by runningsu - zero
and use the password\][poiuy
.
Conclusion and Useful Links
Simplify your Ansible learning journey with this Docker Ansible Lab setup, and enjoy a seamless and scalable environment for honing your skills. For further engagement, you can connect with me on LinkedIn. Additionally, explore the project on GitHub for more details and updates (Please star this project 🙏 ). Happy hacking!
Top comments (0)