George Adams IV
Published in

George Adams IV

My Raspberry Pi 3 Setup

As soon as I heard about the Raspberry Pi 3, I knew I wanted one. The onboard Bluetooth and WiFi, more powerful processor, and maturity of the maker culture around the Pi pushed me over the edge. Once I got it in hand, I had to lay a good foundation on which I could build my little projects. To assist with experimentation, I really want to be able to use Docker. With Docker, I can easily reset if I don’t like how things are going. As someone who works on server automation daily, I can’t just write some shell scripts. I chose Ansible for its operational simplicity.

Before I could do anything, I needed to get an SD card with Raspbian Lite on it. I took a new 16GB card and formatted it to FAT32. To do this, I used SDFormatter (brew cask install sdformatter) to overwrite the whole thing. Most of the time, I would choose a command line option, but this is just too easy. Once the card was formatted, I ran ./flash With everything ready to go, I plugged everything in and booted it up.

The default hostname is raspberrypi so after a brief wait, it’s ready to accept SSH connections. The user is pi and the password is raspberry.

ssh pi@raspberrypi.local

This worked for SSH, but not with Ansible. For that, I needed the real IP. To get it, I could probably log in to my router, but I chose to use the more general solution, nmap.

nmap -p 22

To install all the tools I want and configure them, I always choose Ansible for its operational simplicity. For the Pi, I had to break down the playbooks into two runs. The first playbook ensures the default user has the right SSH key, kernal modules, and WiFi configuration. Next, I needed to SSH in to manually run raspi-config to resize the filesystem and set the locale. I might investigate removing this step in the future, but having to run this terminal UI isn’t that big of a deal since I only have one of these things. Finally, I can install all the goodies I want, including Docker.

ansible-playbook --ask-pass playbooks/new.yml
ssh pi@raspberrypi.local
sudo raspi-config
sudo shutdown -r
ansible-playbook playbooks/site.yml

Much of my inspiration and the flash script came from the Hypriot blog. I couldn’t have gotten to this state as easily without their effort.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store