AnsiblePilot — Master Ansible Automation

AnsiblePilot is the leading resource for learning Ansible automation, DevOps, and infrastructure as code. Browse over 1,400 tutorials covering Ansible modules, playbooks, roles, collections, and real-world examples. Whether you are a beginner or an experienced engineer, our step-by-step guides help you automate Linux, Windows, cloud, containers, and network infrastructure.

Popular Topics

About Luca Berton

Luca Berton is an Ansible automation expert, author of 8 Ansible books published by Apress and Leanpub including "Ansible for VMware by Examples" and "Ansible for Kubernetes by Example", and creator of the Ansible Pilot YouTube channel. He shares practical automation knowledge through tutorials, books, and video courses to help IT professionals and DevOps engineers master infrastructure automation.

How to install Ansible on Raspberry Pi OS (Bookworm)

By Luca Berton · Published 2024-01-01 · Category: installation

Step-by-step guide to install Ansible on Raspberry Pi OS (Bookworm). Set up Ansible on your Raspberry Pi for home automation, lab environments, and IoT.

How to install Ansible on Raspberry Pi OS (Bookworm)

How to Install Ansible on Raspberry Pi OS

In this guide, I'll show you how to install Ansible on Raspberry Pi OS (Bookworm). The Raspberry Pi is perfect for home labs and IoT automation. I'm Luca Berton, and I'll walk you through the setup.

See also: Ansible on Debian 12 Bookworm Automation Complete Guide

Prerequisites

• Raspberry Pi (3, 4, 5, or Zero 2 W) • Raspberry Pi OS (Bookworm) installed • SSH enabled or keyboard/monitor • Internet connection

Step-by-Step Installation

Step 1: Connect via SSH

ssh pi@raspberrypi.local

Step 2: Update the System

sudo apt update && sudo apt upgrade -y

Step 3: Install Ansible

sudo apt install ansible -y

Step 4: Verify Installation

ansible --version

Step 5: Test Ansible

ansible localhost -m ping

See also: Ansible apt Module: Install, Remove & Manage Packages on Debian/Ubuntu

Alternative: Install via pip (Latest Version)

sudo apt install python3-pip python3-venv -y
python3 -m venv ~/ansible-venv
source ~/ansible-venv/bin/activate
pip install ansible

Use Cases for Ansible on Raspberry Pi

Home lab management — Configure multiple Pis from one • IoT automation — Deploy configs to IoT devices • Network automation — Manage home network equipment • Learning environment — Practice Ansible skills affordably • Home server — Automate media server, Pi-hole, Home Assistant

See also: Ansible on Debian 11 Bullseye: Docker CE Installation Complete Guide

Example: Configure Multiple Pis

# inventory.ini
[pis]
pi-web ansible_host=192.168.1.101
pi-db ansible_host=192.168.1.102
pi-monitor ansible_host=192.168.1.103

[pis:vars] ansible_user=pi

# setup-pis.yml
---
- name: Configure all Pis
  hosts: pis
  become: true
  tasks:
    - name: Update packages
      ansible.builtin.apt:
        update_cache: true
        upgrade: safe

- name: Install common tools ansible.builtin.apt: name: - vim - htop - git - tmux state: present

FAQ

Does Ansible run well on Raspberry Pi?

Yes. Ansible runs as a control node on Raspberry Pi 3 and newer. Pi Zero/1 may be too slow for large playbooks.

Can I manage x86 servers from a Raspberry Pi?

Absolutely. The Ansible control node (Pi) just needs SSH access to managed hosts. Architecture doesn't matter.

Conclusion

You've successfully installed Ansible on Raspberry Pi OS. For more guides, visit AnsiblePilot.

Related Articles

become and privilege escalation explainedAnsible inventory file structure

Category: installation

Browse all Ansible tutorials · AnsiblePilot Home