Giter Club home page Giter Club logo

ansible-pi's Introduction

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

ansible-pi's People

Contributors

chrowe avatar dantwining avatar motdotla avatar

Watchers

 avatar

ansible-pi's Issues

Handle hosts better

  1. By default just run on test pis
  2. Add newpi group and only use ssh password for them since having it there after #2 breaks Ansible's ability to login

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.