Skip to content

Quickly setup your Raspberry Pi, with WIFI and Node-Red.

Notifications You must be signed in to change notification settings

chrowe/ansible-pi

 
 

Repository files navigation

ansible-pi

Quickly setup your Raspberry Pi - particularly WIFI settings and NodeRED.

Requirements

Hardware

  1. A Raspberry Pi w/ associated power supply and SD card. 8GB recommended but 4GB should work.
  2. USB wifi adaptor. I recommend the TL-WN722N V2

Software

  1. Ansible is required. The offical docs suggest using pip. I used Homebrew brew install ansible
  2. Add an entry to your ~/.ssh/config file
Host anewpi
    Hostname raspberrypi.local
    User pi
    StrictHostKeyChecking no
  1. Add entry to your ~/.ansible.cfg file
[defaults]
host_key_checking = False

Installation

  1. Clone and setup the ansible script.
git clone https://github.com/chrowe/ansible-pi.git
cd ansible-pi
cp hosts.example hosts
cp wpa_supplicant.conf.example wpa_supplicant.conf
  1. Edit the wpa_supplicant.conf
  • Replace your_wifi_sid with the name of your wifi network
  • Replace your_wifi_password with the password for your wifi network

Note: You can ping raspberrypi.local if you want to get the IP address of your pi.

Usage

Setting up an new Pi

  1. Create new sd card
  • I use Etcher w/ latest Raspian lite
  • touch /Volumes/boot/ssh //Enables ssh
  1. Configure ssh and hostname so Ansible can connect
  • Run ./scripts/anewpi.sh to login to the new pi.
  • Connect Pi to the network and power it up.
    • Note: If you get a message paramiko: The authenticity of host 'raspberrypi.local' can't be established. just type yes and hit enter to continue.
  • Note: You should now be logged into the Pi
  • Run sudo raspi-config and choose "2 Hostname" to set a new hostname for your Pi. You will be prompted to reboot.
  • Add the new hostname to hosts. for example
    [newname]
    newhostname.local
    
  • Test that everything is working
  1. Set up Pagekite

    • cp pagekite_10_account.rc.example pagekite_10_account.rc
    • Change NAME and YOURSECRET to your desired values. See https://pagekite.net/home/
  2. Run Ansible to setup everything else

  • In playbook.yml change hosts to match the newname you just gave your Pi.
  • ansible-playbook -i hosts playbook.yml

Using Pagekite

See http://pagekite.net/wiki/Howto/SshOverPageKite/ for how to set up ssh on your local machine.

Accessing NodeRED

View http://[newname]:1880/# to see Node Red

Using 1wire in NodeRED

  1. Hamburger menu > Manage Palette > Install
  2. Search for "1wire" and install node-red-contrib-1wire
  3. ls /sys/bus/w1/devices/ | grep 28 should show you any devices you have connected

History

About

Quickly setup your Raspberry Pi, with WIFI and Node-Red.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 100.0%