This repository contains Ansible-playbooks for automatically install and configure various application combinations on Raspberry Pi 3 or 4 computer and Raspberry Pi OS 2020-08-20.
Copy your ssh public key to Raspi manually or using ssh-copy-id:
ssh-copy-id [email protected]
Then log in and change the default password raspberry
.
Run ansible-playbook on remote Raspi using command below.
Without -k
flag you must have your ssh id copied into user pi's account as shown above.
ansible-playbook -i '10.255.255.100,' -u pi init.yml --extra-vars "hostname=newraspi.local" --tags "init"
Notice --extra-vars
flag. It contains different variables for different functionalities.
If --tags
flag contains comma separated list of tags, only single tasks labeled
with those tags will be executed.
It might be a good idea to install different functionalities one by one when furnishing a new Raspi.
All extra-vars and tags are not mandatory in all cases.
- hostname - unique hostname for this Raspi
Install basic apps to make Raspibian usable.
--extra-vars "hostname=newraspi.local" --tags "init"
Install stuff needed to activate WLAN access point
Extra-vars
- ap_ssid - WLAN AP name
- ap_passphrase - wpa2 password for AP
Use
--extra-vars "hostname=newraspi.local ap_ssid=SSID ap_passphrase=PASS" --tags "accesspoint"
Download, extract, compile and install the latest Python3
Extra-vars
- python_version - Desired Python version
Use
--extra-vars "python_version=3.9.1" --tags "python3"
Install reverse ssh tunnel using autossh
Extra-vars
- sshport - port to use in remote host. This must be unique for all Raspis
- sshhost - remote host to connect
Use
--extra-vars "sshport=6543 sshhost=server.example.com" --tags "reversessh"
After installation of reversessh you must manually
- ensure remote host has a retricted user
pi
for ssh connections - add key
/root/.ssh/id_ed25519_nopw.pub
to userpi
's/home/pi/.ssh/authorized_keys
- try that connection works with command
sudo ssh -i /root/.ssh/id_ed25519_nopw [email protected]
- reboot Raspberry Pi and after it has booted up, try reverse ssh connection from remote
host using command
ssh pi@localhost -p 6543
Enable camera module.
Use
--tags "camera"
Install and compile software to enable I2S MEMS microphone. Instructions are from Adafruit's web page
Use
--tags "i2ssound"
Enable some NB-IoT HATs.
Use
--tags "i2c,nbiothat"