Skip to content
المشاريع

atao/raspberrypi-setup

عرض على GitHub

حول

⚡ Quickly setup my Raspberry Pi with Ansible !

الأنظمة والبنية التحتية

كيف تُقاس هذه الأرقام

النمو المقاس للنجوم

خلال 24 ساعة
٠
خلال 7 أيام
٠
خلال 15 يومًا
٠
خلال شهر
+١

تغيّر صافي النجوم خلال فترات متداخلة، وليس مجموعًا يوميًا. تبقى القياسات المفقودة فارغة. النجوم تقيس الاهتمام لا جودة البرمجيات.

README.md

الأصل

Raspberry Pi Setup

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.

Roles

Choose which components to install by using tags. Each tag installs specific packages and configurations :

Roles installation :

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 $[email protected]) — ⚠ 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

Containers installation :

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.

Standalone

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://raw.githubusercontent.com/atao/raspberrypi-setup/main/install.sh | bash -s -- all

Ansible

To 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 -K

Run 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.yml

List playbook tasks :

ansible-playbook playbook.yml -i hosts --list-tasks

Access point (ap)

The 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 raspberry is 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.

Examples

Install only some tags :

curl -s https://raw.githubusercontent.com/atao/raspberrypi-setup/main/install.sh | bash -s -- standard,proxy,rfid,docker,web,jd2

Extra arguments are passed to ansible-playbook, for example to set the hotspot passphrase :

curl -s https://raw.githubusercontent.com/atao/raspberrypi-setup/main/install.sh | bash -s -- standard,ap -e ap_psk='your-passphrase'

Debug

Yaml lint

yamllint playbook.yml roles/

Ansible lint

ansible-lint

Check syntax :

ansible-playbook playbook.yml -i hosts --syntax-check

Run 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

استكشف مشاريع مشابهة ومرتبطة

جارٍ التحميل…