Before diving deeper into Ansible, you need to prepare a few basic skills and tools, ranging from Linux CLI, SSH, YAML, to environment setup and installing Ansible itself.

Welcome to the Learn Ansible series! This series will take you from zero to production-ready Ansible, covering fundamental concepts, writing playbooks, and integrating with modern ecosystems such as CI/CD and the cloud. But as the saying goes, "a tree cannot thrive without strong roots". Before you touch ansible-playbook or write beautiful YAML, there are a few basic skills and tools you must have and prepare first.
Why are these prerequisites so important? Ansible is not an application you can use right away without preparation. Ansible is a configuration management tool that runs on top of SSH, is written in Python, and is configured using YAML. That means if you are not yet familiar with these three, your learning journey will feel sluggish and confusing. Imagine wanting to be a ship captain but not knowing how to read a compass — no matter how great the ship is, you will still get lost.
Episode 0 is your roadmap to make sure everyone is ready. We will cover three fundamental skills (Linux CLI, networking & SSH concepts, and YAML), then set up all the software and hardware you need, and finish with installing Ansible and verifying it. Once this episode is done, you will be fully ready to move on to episode 1, which covers the history and background of why Ansible is needed.
Let's start with skills. Without these, no matter how sophisticated your tool setup is, it will be useless. Here are three pillars of skills you should master at least at a basic level.
Ansible was born and grew up in the Linux ecosystem. Although Ansible can technically manage Windows (via WinRM), the majority of real-world use cases are managing Linux servers. That is why being able to operate Linux through the CLI (Command Line Interface) is a hard requirement.
What should you master?
1. Navigation & file management. You should be comfortable moving between directories, viewing contents, and creating, copying, and deleting files. This is the most basic ability you will use every day, including when placing your Ansible playbook files.
pwd # print current working directory
ls -la # list directory contents (including hidden files)
cd /etc/ansible # move to /etc/ansible directory
mkdir -p ~/lab-ansible # create nested directories
cp inventory.yml backup/ # copy a file2. User & group. Ansible is often run with a specific user account, and managing user permissions on managed nodes is an administrator's daily job. You need to know commands like useradd, usermod, groupadd, id, and whoami.
3. File permissions (chmod & chown). This is what most confuses beginners. Every file in Linux has an owner, a group, and access permissions for three groups: owner, group, and others. Those permissions are represented as r (read), w (write), and x (execute).
chmod 644 script.sh # owner: rw-, group: r--, others: r--
chmod 755 deploy.sh # owner: rwx, group: r-x, others: r-x
chmod +x deploy.sh # add execute permission (symbolic)
chown ansible:ansible /opt/app/config.yml # change owner & group
ls -l # verify the result of your changesTip
The numbers in chmod are the sum of octal bits: r=4, w=2, x=1. So 755 means 7(4+2+1) for the owner, 5(4+1) for the group, and 5(4+1) for others. This is a standard you should memorize by heart.
4. Sudo (privilege escalation). Many automation tasks (such as installing packages or changing services) require root privileges. In Ansible, this mechanism is known as become — and on the CLI side, you know it as sudo.
sudo apt update # run a command as root
sudo -i # enter an interactive root shell
sudo -u www-data whoami # run as a specific user
sudo visudo # edit the sudoers configurationWarning
A common beginner mistake: writing a path or command without understanding permissions. A classic example is getting a Permission denied error when reading a configuration file, or overusing chmod 777 on files that should stay secure. Always use the least privilege required (least privilege).
Ansible does not manage servers locally — it manages servers remotely. Every time Ansible runs a task, it establishes a connection to the managed node. Therefore, a basic understanding of networking and especially SSH (Secure Shell) is non-negotiable.
Some networking concepts you need to understand:
22 for SSH, 80 for HTTP, 443 for HTTPS.server1.example.com instead of memorizing an IP.22 is blocked by a firewall, Ansible will never be able to connect.SSH authentication can be done with a password, but the best practice is to use an SSH key pair. The main reasons: it is more secure (the private key is never sent over the network) and it enables automation without human intervention — something that is crucial because Ansible must connect to dozens or even thousands of servers without being asked for a password one by one.
# 1. Generate key pair (public + private)
ssh-keygen -t ed25519 -C "devops@example.com" -f ~/.ssh/id_ed25519
# 2. View the public key (this is what you can share)
cat ~/.ssh/id_ed25519.pub
# 3. Copy the public key to the managed node (once only)
ssh-copy-id -i ~/.ssh/id_ed25519.pub devops@10.0.0.11
# 4. Test the connection without a password
ssh devops@10.0.0.11Important
Never share or store the private key (id_ed25519) carelessly. The private key is your digital identity — if it leaks, someone else can get into your servers. The public key (id_ed25519.pub), on the other hand, can be distributed anywhere because it can only encrypt, not unlock.
The first time you SSH into a server, you will see a warning like this:
The authenticity of host '10.0.0.11 (10.0.0.11)' can't be established.
ED25519 key fingerprint is SHA256:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yesWhen you type yes, that server's fingerprint is stored in the ~/.ssh/known_hosts file. This is a protection mechanism against man-in-the-middle attacks — where a fake server impersonates the real one. Because Ansible runs without human interaction, automation often disables this verification on local labs (not in production!) using the host_key_checking = False option in ansible.cfg, or registers host keys beforehand.
Warning
Disabling host_key_checking is safe only for lab/development environments. In production, disabling host key checking without proper registration is equivalent to opening the door to man-in-the-middle attacks. Don't make this a habit in production!
On the server side (managed node), SSH configuration is managed in the /etc/ssh/sshd_config file. The directives you will adjust most often:
Port 22
PermitRootLogin no
PubkeyAuthentication yes
PasswordAuthentication no
ChallengeResponseAuthentication noTip
For servers managed by Ansible, it is highly recommended to set PubkeyAuthentication yes and PasswordAuthentication no. This forces all access to use SSH keys — more secure and automation-friendly. Don't forget to run sudo systemctl restart sshd after changing this file.
This is probably the most underestimated skill, yet it is the most frequent source of errors in Ansible. YAML (YAML Ain't Markup Language) is a data serialization format that prioritizes human readability. All Ansible configuration — inventory, playbooks, roles, even ansible.cfg written in YAML — uses this format.
The core YAML concepts you must understand:
- sign.# Simple key-value
name: web-server
# List / array
packages:
- nginx
- curl
- htop
# Dictionary / map
web_server:
domain: example.com
port: 80
tls:
enabled: true
cert_path: /etc/ssl/cert.pem
# List of dictionaries (most common in Ansible)
users:
- name: arman
uid: 1001
- name: budi
uid: 1002Caution
The golden rule of YAML: never use tab characters for indentation, and make sure it is consistent (all 2 spaces or all 4 spaces) within one file. The most common error in Ansible playbooks is Syntax Error while loading YAML, which is often caused by nothing more than a tab or inconsistent indentation. When in doubt, use a linter or an editor extension.
To make it easier to tell the concepts apart, here's a quick comparison:
| Concept | Description | Example |
|---|---|---|
| Key-Value | A key and value pair | name: arman |
| List | An ordered collection of values with - | - nginx |
| Dictionary | A collection of indented key-value pairs | tls:\n enabled: true |
| Nested | A combination of lists & dictionaries | a list containing the users map |
Now that the skills are covered, it's time to prepare the equipment. Ansible's architecture splits roles into two sides: the Control Node (the machine where Ansible is installed and commands are executed) and the Managed Nodes (the target servers being managed).
| No | Tool | Type | Level | Description |
|---|---|---|---|---|
| 1. | Laptop / PC / Mini PC | Hardware | Required | Main machine for running the Control Node |
| 2. | Control Node (Linux/macOS/WSL2) | Software | Required | Where Ansible is installed; needs Python 3.9+ & OpenSSH client |
| 3. | Managed Nodes (2-3 Linux VMs) | Software | Required | Managed targets; Ubuntu/Debian/RHEL/Rocky Linux |
| 4. | Hypervisor / Virtualization | Software | Optional | VirtualBox, Proxmox, multipass, or a Cloud VPS to create VMs |
| 5. | Text Editor | Software | Required | VS Code with the Ansible & Red Hat YAML extensions |
| 6. | Python 3.9+ | Software | Required | Runtime for Ansible on the Control Node |
This is the machine where you type ansible-playbook. Its characteristics:
python3 --version # make sure it's >= 3.9
ssh -V # check the OpenSSH client version
uname -a # check OS & kernel (Linux)
which pipx # check whether pipx is installedThese are the "herd" of servers managed by Ansible. For learning, you only need to prepare 2-3 virtual machines (VMs) running Ubuntu, Debian, RHEL, or Rocky Linux. You are free to choose how to create them: you can use VirtualBox (local, free), Proxmox (bare-metal hypervisor), multipass (a simple Ubuntu-style CLI), or a Cloud VPS (DigitalOcean, AWS EC2, Vultr, etc.) if you want to experience a production-like environment.
Tip
What you must remember: every managed node must have (1) Python 3, (2) an active SSH server, and (3) an IP reachable from the Control Node. Ansible's minimal requirement only needs Python 3 on the target side — we will dive deeper into this when discussing the agentless concept in episode 1.
Also make sure every VM already has the SSH public key from the Control Node installed (using ssh-copy-id) so connections run without a password.
Ansible is configuration as code — you will write and read a lot of YAML. A good text editor saves you from indentation mistakes and typos. The industry standard recommendation is Visual Studio Code with two extensions:
Note
The key is not fanaticism about a particular editor. If you are more comfortable with Neovim, Sublime, or JetBrains, go ahead — what matters is that your editor displays YAML indentation clearly and supports highlighting.
Now for the most anticipated part: installing Ansible on the Control Node. The method recommended by the official documentation is to use pipx or a Python virtual environment (venv) — not a global pip install, because that would pollute the system Python environment and could trigger dependency conflicts (a phenomenon known as dependency hell).
pipx installs Python applications in an isolated environment but puts their binaries on PATH so they can be run directly from anywhere. This is the cleanest way to handle CLI tools like Ansible.
# Install pipx (Ubuntu/Debian)
sudo apt update
sudo apt install -y pipx
pipx ensurepath
# Install Ansible (complete package: ansible-core + popular collections)
pipx install --include-deps ansible
# Reload the shell so the new PATH is recognized
exec $SHELLIf you are already familiar with venv, this method is also highly recommended — especially if you want per-repository isolated Ansible projects. It is also a standard practice in many companies.
cd ~/lab-ansible
# Create a virtual environment
python3 -m venv .venv
# Activate the environment
source .venv/bin/activate
# Install Ansible
pip install ansibleImportant
Remember: the venv environment must be activated every time you open a new terminal before running ansible. You will know the environment is active when your terminal prompt starts with (.venv). Forgetting to activate it is one of the most common mistakes after setup.
Once installed, verify it with ansible --version. Correct output should show the Ansible version, Python version, and the location of the default configuration file.
ansible --version
ansible [core 2.16.3]
config file = None
configured module search path = ['/home/devops/.ansible/plugins/modules']
ansible python module location = /home/devops/.venv/lib/python3.11/site-packages/ansible
ansible collection path = /home/devops/.ansible/collections:/usr/share/ansible/collections
executable location = /home/devops/.venv/bin/ansible
python version = 3.11.6 (main, Nov 14 2023) [GCC 12.2.0] (/home/devops/.venv/bin/python3)
jinja version = 3.1.2
libyaml = TrueTip
Notice the python version line in the output above. This proves Ansible is running on top of the Python environment we created — not the system Python. If the version number is 3.9 or higher, you are ready to move on.
As a hands-on finale, let's make sure the Control Node can communicate with managed nodes over SSH. We'll create a simple inventory file and use the ping module (not ICMP ping — this is the Ansible-level ping that tests whether the Control Node can execute Python modules on the target).
[webservers]
10.0.0.11 ansible_user=devops
10.0.0.12 ansible_user=devops
[dbservers]
10.0.0.13 ansible_user=devopsansible -i inventory.ini all -m ping10.0.0.11 | SUCCESS => {
"changed": false,
"ping": "pong"
}
10.0.0.12 | SUCCESS => {
"changed": false,
"ping": "pong"
}
10.0.0.13 | SUCCESS => {
"changed": false,
"ping": "pong"
}If all nodes respond with "pong", that means the SSH connection, key authentication, and Python execution on the managed nodes are all working perfectly. You are officially ready to learn Ansible!
Caution
If any node fails, don't panic. Check in order: (1) Is the IP & port reachable? (ping, nc -zv <ip> 22), (2) Is the public key installed? (ssh-copy-id), (3) Is the firewall not blocking port 22? (4) Is the SSH server active? (sudo systemctl status sshd). This kind of systematic debugging process is exactly what builds a good SRE mindset.
In episode 0 we have laid a solid foundation: mastering three fundamental skills (Linux CLI, networking & SSH, and YAML), preparing the Control Node and Managed Nodes along with their supporting tools, installing Ansible with modern methods (pipx/venv), and even running a first connection test using the ping module.
Key takeaways to carry with you:
pipx or venv), not globally via pip.ansible --version and a ping test before you start.Make sure all the skills and tools above are ready, because the next episode will go deeper into the concepts. In episode 1, we will discuss the history, background, and why the modern world needs Ansible — from the evolution of automation from manual shell scripting to Infrastructure as Code, why Ansible chose the agentless approach, and how it positions itself against other tools like Puppet, Chef, and Terraform. Keep your enthusiasm up, because the Ansible learning journey has only just begun! 😁