aboutsummaryrefslogtreecommitdiffstats
path: root/roles/raspbian-template/README.md
blob: 1efc890343a66912f2fc73301db90b07745019cb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
raspbian-template
=================

About
-----

This is a template for an ansible role setting up a
[Raspberry Pi][rpi] running [Raspbian][raspbian].

[rpi]: https://www.raspberrypi.org
[raspbian]: https://www.raspbian.org

Bootstrap a new Raspberry Pi
----------------------------

Download a "Lite" image from the Raspberry Pi [homepage][downloads],
and write it to your sd-card as described on that page.

Before removing the sd-card from your computer make sure to mount
the vfat filesystem on the first partition and create an (empty)
file called "ssh". This enables an [SSH][ssh] daemon on boot so
you and Ansible can log into it on boot.

Now move your sd-card to the Raspberry Pi, connect an ethernet cable
and lastly the power.
Once you figure out the ip address of the Raspberry Pi it's a good idea
to ssh into it manually just to accept the host key:
```sh
ssh pi@<ip address>
```
Now run the following command to bootstrap it:

```sh
ansible-playbook -D \
  -i raspbian-template, \
  -e ansible_host=<ip address> \
  -e ansible_ssh_user=pi \
  -e ansible_ssh_pass=raspberry \
  -e '{"users":{"<your labitat user>":"sudo"}}' \
  raspbian-template.yml
```

Now go buy a Mate or something. This will take a long time..

Once it finishes you should have a fully upgraded Raspbian
with your Labitat user and all the ssh keys in place.
Hence you should now be able run ansible with your own
ssh user. Eg. just

```sh
ansible-playbook -D \
  -i raspbian-template, \
  -e ansible_host=<ip address> \
  -e '{"users":{"<your labitat user>":"sudo"}}' \
  raspbian-template.yml
```

Now is a good time to ssh into it and reboot it,
so it uses the new network setup after boot.

[downloads]: https://www.raspberrypi.org/downloads/raspbian/
[ssh]: https://en.wikipedia.org/wiki/Secure_Shell