Skip to content

Add a new CHIP

batchku edited this page Dec 29, 2016 · 9 revisions

Intro

Ansible seems to be the right way to do this.

Some additional references:

Before starting

We het up password-less ssh like this or this. The process involves:

  1. Generate ssh keys if you don't have them. If you see two files called "id_rsa" when you run: ls -l ~/.ssh

  2. Copy your public ssh key (from the controller computer) to all hosts, one by one; easiest way is to install ssh-copy-id with brew and run it:

brew install ssh-copy-id ssh-copy-id [email protected]

  1. Install Ansible brew install ansible

Configure Chip to Connect to network

Use this to setup wireless networking on your chip with the built-in wifi: NOTE: don't mess with /etc/network/interfaces like it says here.

Connect to CHIP over USB

Use this to connect to your chip for the first time, before networking is setup:

  1. connect chip to computer with USB
  2. open terminal on computer, and run ls /dev/tty*
  3. look for the item that has a name that's different than the others (!), usually tty.usbmodem...
  4. in computer's terminal, type 'screen /dev/tty.usbmodem...', where the 'tty.usbmodem...' is whatever you saw in step 3.

Configure CHIP for your wifi network

  1. list all connections: sudo nmcli co

  2. list all available networks: nmcli device wifi list

  3. connect to a wifi network; will reconnect to it on reboot: nmcli device wifi connect '(your wifi network name/SSID)' password '(your wifi password)' ifname wlan0

in our case with network called "Chipchestra" with password "jengajenga", it would be: nmcli device wifi connect 'Chipchestra' password 'jengajenga' ifname wlan0

Set up the hosts (i.e. the CHIPS):

Edit the file called "hosts" to your new chip

[chipchestra]
chip1 ansible_ssh_host=192.168.1.101 ansible_ssh_user=root ansible_ssh_pass=chip host_key_checking=false
chip4 ansible_ssh_host=192.168.1.104 ansible_ssh_user=root ansible_ssh_pass=chip host_key_checking=false

This creates a "group" called chipchestra with two hosts called chip1 and chip4; IP address and login credentials follow

Using Ansible Ad-Hoc Commands:

Ping all servers in "Chipchestra" group:
ansible chipchestra -m ping

Execute shell command on all hosts:
ansible chipchestra -s -m shell -a 'ls -l'

Use RSync to synchronize a folder on the controller computer with one on remote hosts:

ansible chipchestra -m synchronize -a "src=/Users/ali/Documents/Development/chip-party/chip-ansible/files/pd-patches dest=/samba-share/"

Using Ansible Playbooks

Run a playbook from the controller computer:
ansible-playbook playbook.yml

Clone this wiki locally