Skip to content

stevewoolley/pi-fleet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pi-fleet

Goal

Manage fleet of raspberry pies with Ansible scripts using Raspbian OS.

Real Goal

I am lazy so want to be able to deploy code patches and OS updates with a single click.

Parts

My fleet is a mix of (but honestly any Raspberry Pi should be fine):

All of which can be purchased on Amazon or at my favorite gadget store Adafruit.

Recommendation

Buy the Raspberry Pi Model 3B if you need some horsepower. Otherwise get a Raspberry Pi Model Zero W especially if you need a small form factor. Skip the Raspberry Pi Model B+, Raspberry Pi Model Zero W is cheaper, smaller, has built in wifi and is just as powerful.

Steps for a new Pi (non-graphical)

Assumption: using Mac OS command line

  1. Download latest raspbian image

  2. Install image on available SD card (instructions)

  3. As of the November 2016 release, Raspbian has the SSH server disabled by default. You will have to enable it manually. SSH can be enabled by placing an empty file named 'ssh', without any extension, onto the boot partition of the SD card. While the SD card is still mounted:

    sudo -i
    cd /Volumes/boot
    touch ssh
  4. Join your Pi to your network:

    • For Pies with wifi adapter only While the SD card is still mounted:
      sudo -i
      cd /Volumes/boot
      Create a wpa_supplicant.conf file for your specific network in this directory.
      • Example: wpa_supplicant.conf.example
  5. Find your Pi on the network

    1. Insert SD card into new Pi, connect live ethernet cable (if applicable) from local network, and power up the Pi

    2. On your desktop/laptop, populate you network cache (example shown using my local network CIDR):

      nmap -sP 192.168.1.0/24
    3. Look for the IP address of your new Pi

      arp -na | grep b8:27:eb

      This will display the IP addresses of all the Pies in your local network, you may have to determine which one is your new Pi. Let's assume the IP address of the new Pi is 192.168.1.24

  6. Make sure you have generated your local ssh keys. If not:

    ssh-keygen
  7. Copy your ssh keys onto the new Pi (insert your IP address (or maybe raspberrypi.local) for the example IP of 192.168.1.24)

    cat ~/.ssh/id_rsa.pub | ssh pi@192.168.1.24 "mkdir -p ~/.ssh && cat >>  ~/.ssh/authorized_keys"

    You will be prompted for the password for the new Pi, default: raspberry

  8. In pi-fleet working directory, update variables for site specific values:

    • host_vars/*
    • roles/*/vars
    • hosts (initially set hostname and IP address of new Pi)
       [site]
         my_new_pi         ansible_host=192.168.1.24
    
  9. Run ansible scripts:

    ansible-playbook -s site.yml --limit my_new_pi --ask-vault-pass
    

    The ask-vault-pass is used if you are using an encrypted vault to store variables *Note: Had to disable bluetooth on new Pi

    update-rc.d bluetooth disable
    

About

Ansible scripts to manage a fleet of raspberry pi

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published