This Ansible playbook is designed to rapidly set up your Raspberry Pi.
It's compatible with all models. It has been successfully tested on multiple models, including the Pi Zero W, Pi Zero 2W, and Pi 4B, among others. The playbook should work well on both Debian and Debian-based distributions.
Choose which components to install by using tags. Each tag installs specific packages and configurations :
| Tag | Description | Notes |
|---|---|---|
| standard, std | Core installation and configuration | standard packages, bashrc, vimrc |
| ap | start a hotspot when no Ethernet cable is plugged in | Useful for mobile use to access tools. → AP config file (Access with ssh $USER@10.0.0.1) — ⚠ change the default passphrase, see Access point |
| display | Configure display with LCD-show | Set display_lcd_script in defaults (or -e display_lcd_script=LCD35-show) to match your screen. Only runs with --tags display. |
| docker | Docker installation | Container runtime environment |
| tor | Tor installation | See README |
| rfid | RFID tools installation | Tools (libnfc, mfoc, mfcuk) and keys from MifareClassicTool → See Notes |
| sdr | SDR tools installation | rtl_433, rtl-sdr-blog, csdr, multimon-ng and SoX |
| web | Nginx and Certbot installation | |
| wifi | Wifi and GPS tools installation | Wireless security testing and wardriving |
| Tag | Description | Notes |
|---|---|---|
| jd2 | docker container for JDownloader 2 jlesage/jdownloader-2 | See Configuration tips' |
| portainer | Portainer CE - a lightweight service delivery platform for containerized applications portainer/portainer-ce | Containers manager |
| proxy | Rotating Tor HTTP proxy container | Provides one HTTP proxy endpoint with many concurrent tunnels to the Tor network. |
To setup directly from the Pi, run the following command : Before run command you must setup your Pi with Raspberry Pi Imager.
Next run command :
curl -s https://github.com/raw.githubusercontent.com/atao/raspberrypi-setup/main/install.sh | bash -s -- allTo setup run the following command :
git clone https://github.com/atao/raspberrypi-setup.git
cd raspberrypi-setup
ansible-playbook playbook.yml -i hosts --tags all -KRun it as your regular user (-K asks for the sudo password). If you only have ansible-core, install the required collections first :
ansible-galaxy collection install -r requirements.ymlList playbook tasks :
ansible-playbook playbook.yml -i hosts --list-tasksThe ap role creates a Wi-Fi hotspot (SSID raspberry, Pi reachable at 10.0.0.1) that is enabled automatically when no Ethernet cable is plugged in. The check runs at boot and again each time an Ethernet cable is plugged in or unplugged (NetworkManager dispatcher script). Logs : journalctl -u checkap.
- Cable plugged in : the hotspot is stopped and the Wi-Fi radio is turned off (
nmcli radio wifi off). The Pi is then only reachable through Ethernet: it no longer connects to any other Wi-Fi network as a client either. - Cable unplugged : the Wi-Fi radio is turned back on, then the hotspot is started.
Docker's virtual interfaces (veth…, unmanaged by NetworkManager) are ignored when looking for the Ethernet interface.
⚠ The default passphrase
raspberryis public: change it before using the hotspot. The playbook prints a warning as long as it is unchanged. Note that fail2ban never bans private addresses (10.0.0.0/8, see standard vars), which includes the hotspot clients: a weak passphrase gives SSH brute-force access without any ban.
Set your own passphrase (8 characters minimum) either in roles/ap/vars/main.yml (ap_psk), or on the command line :
ansible-playbook playbook.yml -i hosts --tags ap -K -e ap_psk='your-passphrase'To change it later, run the same command again: the existing connection is updated in place.
Install only some tags :
curl -s https://github.com/raw.githubusercontent.com/atao/raspberrypi-setup/main/install.sh | bash -s -- standard,proxy,rfid,docker,web,jd2Extra arguments are passed to ansible-playbook, for example to set the hotspot passphrase :
curl -s https://github.com/raw.githubusercontent.com/atao/raspberrypi-setup/main/install.sh | bash -s -- standard,ap -e ap_psk='your-passphrase'Yaml lint
yamllint playbook.yml roles/Ansible lint
ansible-lintCheck syntax :
ansible-playbook playbook.yml -i hosts --syntax-checkRun the tests (no root, no Raspberry Pi needed: role variables, playbook structure, template rendering, install.sh, and the behaviour of CheckAP.sh and of the NetworkManager dispatcher with mocked nmcli / systemctl; see tests/README.md) :
ansible-playbook tests/test.yml--
Inspired from geerlingguy / mac-dev-playbook and nico2che / mac-setup