Ansible tutorial lab environment with a ready-to-use Docker and VS Code Dev Containers setup. A step-by-step playground for practical Ansible learning and hands-on experience.
The full step-by-step course content can be found at:
- Ansible Basics in 13 Steps (English version)
- Основы Ansible за 13 шагов (Russian version)
To get the most out of the material, it is highly recommended to manually repeat all the steps of the guide by creating the required artifacts yourself. This will help you gain a deeper understanding of the processes and better retain the key concepts.
-
Install Docker Desktop:
For Windows, Mac, or Linux — follow the official instructions:
https://docs.docker.com/get-docker/ -
Clone the course repository:
git clone https://github.com/pprometey/ansible-tutorial-lab.git
Change into the cloned repository directory, which will be the root directory of the project:
cd ansible-tutorial-lab -
Set up the environment variable for SSH keys:
-
Windows (PowerShell):
[System.Environment]::SetEnvironmentVariable("DEFAULT_SSH_KEY", "<path_to_ssh_keys_folder>", "User")
Then restart all VS Code windows.
-
Mac/Linux (bash):
Add the following line to your~/.bashrcor~/.zshrc:export DEFAULT_SSH_KEY="<path_to_ssh_keys_folder>"
Then run:
source ~/.bashrc
or restart your terminal.
The specified folder must contain two files named
id_rsaandid_rsa.pub— the private and public SSH keys that Ansible will use to connect to the target nodes. -
-
Verify that the variable is set:
-
Windows (PowerShell):
$env:DEFAULT_SSH_KEY -
Mac/Linux (bash):
echo $DEFAULT_SSH_KEY
-
-
Launch the isolated environment in VS Code with the Remote - Containers extension:
- Open VS Code by running
code . - Install the Remote - Containers extension if you haven't already.
- Press
F1and select Remote-Containers: Reopen in Container.
This will start containers for the Ansible master and the target nodes.
- Open VS Code by running